1. 01 7月, 2013 23 次提交
  2. 30 6月, 2013 3 次提交
  3. 26 6月, 2013 1 次提交
  4. 25 6月, 2013 7 次提交
  5. 21 6月, 2013 6 次提交
    • A
      powerpc: Optimize hugepage invalidate · 1a527286
      Aneesh Kumar K.V 提交于
      Hugepage invalidate involves invalidating multiple hpte entries.
      Optimize the operation using H_BULK_REMOVE on lpar platforms.
      On native, reduce the number of tlb flush.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      1a527286
    • A
      powerpc/THP: Enable THP on PPC64 · 437d4964
      Aneesh Kumar K.V 提交于
      We enable only if the we support 16MB page size.
      Reviewed-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      437d4964
    • A
      powerpc: split hugepage when using subpage protection · d8e355a2
      Aneesh Kumar K.V 提交于
      We find all the overlapping vma and mark them such that we don't allocate
      hugepage in that range. Also we split existing huge page so that the
      normal page hash can be invalidated and new page faulted in with new
      protection bits.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      d8e355a2
    • A
      powerpc: disable assert_pte_locked for collapse_huge_page · a00e7bea
      Aneesh Kumar K.V 提交于
      With THP we set pmd to none, before we do pte_clear. Hence we can't
      walk page table to get the pte lock ptr and verify whether it is locked.
      THP do take pte lock before calling pte_clear. So we don't change the locking
      rules here. It is that we can't use page table walking to check whether
      pte locks are held with THP.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      a00e7bea
    • A
      powerpc: Prevent gcc to re-read the pagetables · 7888b4dd
      Aneesh Kumar K.V 提交于
      GCC is very likely to read the pagetables just once and cache them in
      the local stack or in a register, but it is can also decide to re-read
      the pagetables. The problem is that the pagetable in those places can
      change from under gcc.
      
      With THP/hugetlbfs the pmd (and pgd for hugetlbfs giga pages) can
      change under gup_fast. The pages won't be freed untill we finish
      gup fast because we have irq disabled and we free these pages via
      rcu callback.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      7888b4dd
    • A
      powerpc: Make linux pagetable walk safe with THP enabled · 0ac52dd7
      Aneesh Kumar K.V 提交于
      We need to have irqs disabled to handle all the possible parallel update for
      linux page table without holding locks.
      
      Events that we are intersted in while walking page tables are
      1) Page fault
      2) umap
      3) THP split
      4) THP collapse
      
      A) local_irq_disabled:
      ------------------------
      1) page fault:
      A none to valid transition via page fault is not an issue because we
      would either see a none or valid. If it is none, we would error out
      the page table walk. We may need to use on stack values when checking for
      type of page table elements, because if we do
      
      if (!is_hugepd()) {
          if (!pmd_none() {
             if (pmd_bad() {
      
      We could take that bad condition because the pmd got converted to a hugepd
      after the !is_hugepd check via a hugetlb fault.
      
      The right way would be to check for pmd_none higher up or use on stack value.
      
      2) A valid to none conversion via unmap:
      We can safely walk the upper level table, because we don't remove the the
      page table entries until rcu grace period. So even if we followed a
      wrong pointer we still have the pointer valid till the grace period.
      
      A PTE pointer returned need to be atomically checked for _PAGE_PRESENT and
       _PAGE_BUSY. A valid pointer returned could becoming none later. To prevent
      pte_clear we take _PAGE_BUSY.
      
      3) THP split:
      A valid transparent hugepage is converted to nomal page. Before we split we
      do pmd_splitting_flush, which sets the hugepage PTE to _PAGE_SPLITTING
      So when walking page table we need to check for pmd_trans_splitting and
      handle that. The pte returned should also need to be checked for
      _PAGE_SPLITTING before setting _PAGE_BUSY similar to _PAGE_PRESENT. We save
      the value of PTE on stack and check for the flag in the local pte value.
      If we don't have the value set we can safely operate on the local pte value
      and we atomicaly set _PAGE_BUSY.
      
      4) THP collapse:
      A normal page gets converted to hugepage. In the collapse path, we
      mark the pmd none early (pmdp_clear_flush). With irq disabled, if we
      are aleady walking page table we would see the pmd_none and won't continue.
      If we see a valid PMD, we should still check for _PAGE_PRESENT before
      setting _PAGE_BUSY, to make sure we didn't collapse the PTE to a Huge PTE.
      Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      0ac52dd7