smaps_pte_entry() doesn't ignore zero_huge_page, but it ignore zero_page, because vm_normal_page() will ignore it. We remove vm_normal_page() call, because walk_page_range() have ignore VM_PFNMAP vma maps, it's safe to just use pfn_valid(), so that we can also consider zero_page to be a valid page. Another change is that we only add map_count >= 2 or mapcount == 1 pages into pss, because zero_page and huge_zero_page's _mapcount is zero, this means pss will consider evey zero page as a PAGE_SIZE for every process, this is not correct for pss statistic. We ignore zero page for pss, just add zero page into rss statistic. Signed-off-by: Yalin Wang <yalin.wang@xxxxxxxxxxxxxx> --- fs/proc/task_mmu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 4e0388c..ce503d3 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -458,7 +458,9 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr, int mapcount; if (pte_present(ptent)) { - page = vm_normal_page(vma, addr, ptent); + if (!pte_special(ptent) && pfn_valid(pte_pfn(ptent))) + page = pfn_to_page(pte_pfn(ptent)); + } else if (is_swap_pte(ptent)) { swp_entry_t swpent = pte_to_swp_entry(ptent); @@ -491,7 +493,7 @@ static void smaps_pte_entry(pte_t ptent, unsigned long addr, else mss->shared_clean += ptent_size; mss->pss += (ptent_size << PSS_SHIFT) / mapcount; - } else { + } else if (mapcount == 1){ if (pte_dirty(ptent) || PageDirty(page)) mss->private_dirty += ptent_size; else -- 2.1.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href