diff options
author | Dave Hansen <dave@linux.vnet.ibm.com> | 2011-03-22 19:33:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:04 -0400 |
commit | 22e057c5923e60debad318cbeaee33033b110bc8 (patch) | |
tree | 7dd6d7b5ed93974263377cd458384b85b2847041 /fs/proc/task_mmu.c | |
parent | 3c9acc7849b1eab7ffc75e933404c5f32865d9a2 (diff) |
smaps: teach smaps_pte_range() about THP pmds
This adds code to explicitly detect and handle pmd_trans_huge() pmds. It
then passes HPAGE_SIZE units in to the smap_pte_entry() function instead
of PAGE_SIZE.
This means that using /proc/$pid/smaps now will no longer cause THPs to be
broken down in to small pages.
Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
Reviewed-by: Eric B Munson <emunson@mgebm.net>
Tested-by: Eric B Munson <emunson@mgebm.net>
Acked-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michael J Wolf <mjwolf@us.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/task_mmu.c')
-rw-r--r-- | fs/proc/task_mmu.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index d7e2af334076..26f9cc00102c 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/mm.h> | 1 | #include <linux/mm.h> |
2 | #include <linux/hugetlb.h> | 2 | #include <linux/hugetlb.h> |
3 | #include <linux/huge_mm.h> | ||
3 | #include <linux/mount.h> | 4 | #include <linux/mount.h> |
4 | #include <linux/seq_file.h> | 5 | #include <linux/seq_file.h> |
5 | #include <linux/highmem.h> | 6 | #include <linux/highmem.h> |
@@ -7,6 +8,7 @@ | |||
7 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
8 | #include <linux/pagemap.h> | 9 | #include <linux/pagemap.h> |
9 | #include <linux/mempolicy.h> | 10 | #include <linux/mempolicy.h> |
11 | #include <linux/rmap.h> | ||
10 | #include <linux/swap.h> | 12 | #include <linux/swap.h> |
11 | #include <linux/swapops.h> | 13 | #include <linux/swapops.h> |
12 | 14 | ||
@@ -385,8 +387,25 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
385 | pte_t *pte; | 387 | pte_t *pte; |
386 | spinlock_t *ptl; | 388 | spinlock_t *ptl; |
387 | 389 | ||
388 | split_huge_page_pmd(walk->mm, pmd); | 390 | spin_lock(&walk->mm->page_table_lock); |
389 | 391 | if (pmd_trans_huge(*pmd)) { | |
392 | if (pmd_trans_splitting(*pmd)) { | ||
393 | spin_unlock(&walk->mm->page_table_lock); | ||
394 | wait_split_huge_page(vma->anon_vma, pmd); | ||
395 | } else { | ||
396 | smaps_pte_entry(*(pte_t *)pmd, addr, | ||
397 | HPAGE_PMD_SIZE, walk); | ||
398 | spin_unlock(&walk->mm->page_table_lock); | ||
399 | return 0; | ||
400 | } | ||
401 | } else { | ||
402 | spin_unlock(&walk->mm->page_table_lock); | ||
403 | } | ||
404 | /* | ||
405 | * The mmap_sem held all the way back in m_start() is what | ||
406 | * keeps khugepaged out of here and from collapsing things | ||
407 | * in here. | ||
408 | */ | ||
390 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); | 409 | pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
391 | for (; addr != end; pte++, addr += PAGE_SIZE) | 410 | for (; addr != end; pte++, addr += PAGE_SIZE) |
392 | smaps_pte_entry(*pte, addr, PAGE_SIZE, walk); | 411 | smaps_pte_entry(*pte, addr, PAGE_SIZE, walk); |