Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

break out numa_maps gather_pte_stats() checks

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>

authored by

Dave Hansen and committed by
Linus Torvalds
3200a8aa eb4866d0

+24 -15
+24 -15
fs/proc/task_mmu.c
··· 904 904 md->node[page_to_nid(page)] += nr_pages; 905 905 } 906 906 907 + static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma, 908 + unsigned long addr) 909 + { 910 + struct page *page; 911 + int nid; 912 + 913 + if (!pte_present(pte)) 914 + return NULL; 915 + 916 + page = vm_normal_page(vma, addr, pte); 917 + if (!page) 918 + return NULL; 919 + 920 + if (PageReserved(page)) 921 + return NULL; 922 + 923 + nid = page_to_nid(page); 924 + if (!node_isset(nid, node_states[N_HIGH_MEMORY])) 925 + return NULL; 926 + 927 + return page; 928 + } 929 + 907 930 static int gather_pte_stats(pmd_t *pmd, unsigned long addr, 908 931 unsigned long end, struct mm_walk *walk) 909 932 { ··· 938 915 md = walk->private; 939 916 orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); 940 917 do { 941 - struct page *page; 942 - int nid; 943 - 944 - if (!pte_present(*pte)) 945 - continue; 946 - 947 - page = vm_normal_page(md->vma, addr, *pte); 918 + struct page *page = can_gather_numa_stats(*pte, md->vma, addr); 948 919 if (!page) 949 920 continue; 950 - 951 - if (PageReserved(page)) 952 - continue; 953 - 954 - nid = page_to_nid(page); 955 - if (!node_isset(nid, node_states[N_HIGH_MEMORY])) 956 - continue; 957 - 958 921 gather_stats(page, md, pte_dirty(*pte), 1); 959 922 960 923 } while (pte++, addr += PAGE_SIZE, addr != end);