diff options
author | Dave Hansen <dave@linux.vnet.ibm.com> | 2011-09-20 15:19:39 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-03 11:40:38 -0700 |
commit | b879781180172696903fac604ba44c3204e0c1e4 (patch) | |
tree | c359769577a1db75d92708e006118583a99797ca | |
parent | a19dcc747653657eeea06b417d8e4593f8f44536 (diff) | |
download | kernel_samsung_crespo-b879781180172696903fac604ba44c3204e0c1e4.zip kernel_samsung_crespo-b879781180172696903fac604ba44c3204e0c1e4.tar.gz kernel_samsung_crespo-b879781180172696903fac604ba44c3204e0c1e4.tar.bz2 |
break out numa_maps gather_pte_stats() checks
commit 3200a8aaab0c9ccdc0f59b0dac2d4a47029137fa upstream.
gather_pte_stats() does a number of checks on a target page
to see whether it should even be considered for statistics.
This breaks that code out in to a separate function so that
we can use it in the transparent hugepage case in the next
patch.
Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
Acked-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Christoph Lameter <cl@gentwo.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | fs/proc/task_mmu.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 61342a4..9dca07e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -904,6 +904,29 @@ static void gather_stats(struct page *page, struct numa_maps *md, int pte_dirty, md->node[page_to_nid(page)] += nr_pages; } +static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma, + unsigned long addr) +{ + struct page *page; + int nid; + + if (!pte_present(pte)) + return NULL; + + page = vm_normal_page(vma, addr, pte); + if (!page) + return NULL; + + if (PageReserved(page)) + return NULL; + + nid = page_to_nid(page); + if (!node_isset(nid, node_states[N_HIGH_MEMORY])) + return NULL; + + return page; +} + static int gather_pte_stats(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) { @@ -915,23 +938,9 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, md = walk->private; orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); do { - struct page *page; - int nid; - - if (!pte_present(*pte)) - continue; - - page = vm_normal_page(md->vma, addr, *pte); + struct page *page = can_gather_numa_stats(*pte, md->vma, addr); if (!page) continue; - - if (PageReserved(page)) - continue; - - nid = page_to_nid(page); - if (!node_isset(nid, node_states[N_HIGH_MEMORY])) - continue; - gather_stats(page, md, pte_dirty(*pte), 1); } while (pte++, addr += PAGE_SIZE, addr != end); |