From 8bcb61e3534e5ee77d192dfd205820fa0f05a03b Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Tue, 20 Sep 2011 15:19:39 -0700 Subject: [PATCH] --- yaml --- r: 264019 b: refs/heads/master c: 3200a8aaab0c9ccdc0f59b0dac2d4a47029137fa h: refs/heads/master i: 264017: d7deb9c6001bdcd4fcd58fbce11d0e6c518bcdab 264015: 459a4de42a198e5f3b6e291455c0ae46a8b479c9 v: v3 --- [refs] | 2 +- trunk/fs/proc/task_mmu.c | 39 ++++++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/[refs] b/[refs] index 70ae6f83b8a6..2bbf726fdb8a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eb4866d0066ffd5446751c102d64feb3318d8bd1 +refs/heads/master: 3200a8aaab0c9ccdc0f59b0dac2d4a47029137fa diff --git a/trunk/fs/proc/task_mmu.c b/trunk/fs/proc/task_mmu.c index 61342a454bd9..9dca07e0758d 100644 --- a/trunk/fs/proc/task_mmu.c +++ b/trunk/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);