Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264019
b: refs/heads/master
c: 3200a8a
h: refs/heads/master
i:
  264017: d7deb9c
  264015: 459a4de
v: v3
  • Loading branch information
Dave Hansen authored and Linus Torvalds committed Sep 21, 2011
1 parent 9cc4406 commit 8bcb61e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb4866d0066ffd5446751c102d64feb3318d8bd1
refs/heads/master: 3200a8aaab0c9ccdc0f59b0dac2d4a47029137fa
39 changes: 24 additions & 15 deletions trunk/fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down

0 comments on commit 8bcb61e

Please sign in to comment.