aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorChen, Kenneth W <kenneth.w.chen@intel.com>2006-12-06 23:32:03 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:21 -0500
commit39dde65c9940c97fcd178a3d2b1c57ed8b7b68aa (patch)
tree750818d68ac7381f80fec31491e1d1c78df4b9f6 /mm/hugetlb.c
parente1dbeda60a7ea9e82a908d93c07308d104d50d79 (diff)
[PATCH] shared page table for hugetlb page
Following up with the work on shared page table done by Dave McCracken. This set of patch target shared page table for hugetlb memory only. The shared page table is particular useful in the situation of large number of independent processes sharing large shared memory segments. In the normal page case, the amount of memory saved from process' page table is quite significant. For hugetlb, the saving on page table memory is not the primary objective (as hugetlb itself already cuts down page table overhead significantly), instead, the purpose of using shared page table on hugetlb is to allow faster TLB refill and smaller cache pollution upon TLB miss. With PT sharing, pte entries are shared among hundreds of processes, the cache consumption used by all the page table is smaller and in return, application gets much higher cache hit ratio. One other effect is that cache hit ratio with hardware page walker hitting on pte in cache will be higher and this helps to reduce tlb miss latency. These two effects contribute to higher application performance. Signed-off-by: Ken Chen <kenneth.w.chen@intel.com> Acked-by: Hugh Dickins <hugh@veritas.com> Cc: Dave McCracken <dmccr@us.ibm.com> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Gibson <david@gibson.dropbear.id.au> Cc: Adam Litke <agl@us.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f7355bf2f28..9244971b679 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -386,6 +386,9 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
386 if (!ptep) 386 if (!ptep)
387 continue; 387 continue;
388 388
389 if (huge_pmd_unshare(mm, &address, ptep))
390 continue;
391
389 pte = huge_ptep_get_and_clear(mm, address, ptep); 392 pte = huge_ptep_get_and_clear(mm, address, ptep);
390 if (pte_none(pte)) 393 if (pte_none(pte))
391 continue; 394 continue;
@@ -658,11 +661,14 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
658 BUG_ON(address >= end); 661 BUG_ON(address >= end);
659 flush_cache_range(vma, address, end); 662 flush_cache_range(vma, address, end);
660 663
664 spin_lock(&vma->vm_file->f_mapping->i_mmap_lock);
661 spin_lock(&mm->page_table_lock); 665 spin_lock(&mm->page_table_lock);
662 for (; address < end; address += HPAGE_SIZE) { 666 for (; address < end; address += HPAGE_SIZE) {
663 ptep = huge_pte_offset(mm, address); 667 ptep = huge_pte_offset(mm, address);
664 if (!ptep) 668 if (!ptep)
665 continue; 669 continue;
670 if (huge_pmd_unshare(mm, &address, ptep))
671 continue;
666 if (!pte_none(*ptep)) { 672 if (!pte_none(*ptep)) {
667 pte = huge_ptep_get_and_clear(mm, address, ptep); 673 pte = huge_ptep_get_and_clear(mm, address, ptep);
668 pte = pte_mkhuge(pte_modify(pte, newprot)); 674 pte = pte_mkhuge(pte_modify(pte, newprot));
@@ -671,6 +677,7 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
671 } 677 }
672 } 678 }
673 spin_unlock(&mm->page_table_lock); 679 spin_unlock(&mm->page_table_lock);
680 spin_unlock(&vma->vm_file->f_mapping->i_mmap_lock);
674 681
675 flush_tlb_range(vma, start, end); 682 flush_tlb_range(vma, start, end);
676} 683}