The patch titled Subject: thp: use mm_file_counter to determine update which rss counter has been added to the -mm tree. Its filename is thp-use-mm_file_counter-to-determine-update-which-rss-counter.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/thp-use-mm_file_counter-to-determine-update-which-rss-counter.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/thp-use-mm_file_counter-to-determine-update-which-rss-counter.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Subject: thp: use mm_file_counter to determine update which rss counter Since eca56ff906b ("mm, shmem: add internal shmem resident memory accounting"), MM_SHMEMPAGES is added to separate the shmem accounting from regular files. So, all shmem pages should be accounted to MM_SHMEMPAGES instead of MM_FILEPAGES. And, normal 4K shmem pages have been accounted to MM_SHMEMPAGES, so shmem thp pages should be not treated differently. Account them to MM_SHMEMPAGES via mm_counter_file() since shmem pages are swap backed to keep consistent with normal 4K shmem pages. This will not change the rss counter of processes since shmem pages are still a part of it. Link: http://lkml.kernel.org/r/1529442518-17398-1-git-send-email-yang.shi@xxxxxxxxxxxxxxxxx Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/huge_memory.c | 4 ++-- mm/memory.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff -puN mm/huge_memory.c~thp-use-mm_file_counter-to-determine-update-which-rss-counter mm/huge_memory.c --- a/mm/huge_memory.c~thp-use-mm_file_counter-to-determine-update-which-rss-counter +++ a/mm/huge_memory.c @@ -1740,7 +1740,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, } else { if (arch_needs_pgtable_deposit()) zap_deposited_table(tlb->mm, pmd); - add_mm_counter(tlb->mm, MM_FILEPAGES, -HPAGE_PMD_NR); + add_mm_counter(tlb->mm, mm_counter_file(page), -HPAGE_PMD_NR); } spin_unlock(ptl); @@ -2088,7 +2088,7 @@ static void __split_huge_pmd_locked(stru SetPageReferenced(page); page_remove_rmap(page, true); put_page(page); - add_mm_counter(mm, MM_FILEPAGES, -HPAGE_PMD_NR); + add_mm_counter(mm, mm_counter_file(page), -HPAGE_PMD_NR); return; } else if (is_huge_zero_pmd(*pmd)) { /* diff -puN mm/memory.c~thp-use-mm_file_counter-to-determine-update-which-rss-counter mm/memory.c --- a/mm/memory.c~thp-use-mm_file_counter-to-determine-update-which-rss-counter +++ a/mm/memory.c @@ -3372,7 +3372,7 @@ static int do_set_pmd(struct vm_fault *v if (write) entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); - add_mm_counter(vma->vm_mm, MM_FILEPAGES, HPAGE_PMD_NR); + add_mm_counter(vma->vm_mm, mm_counter_file(page), HPAGE_PMD_NR); page_add_file_rmap(page, true); /* * deposit and withdraw with pmd lock held _ Patches currently in -mm which might be from yang.shi@xxxxxxxxxxxxxxxxx are doc-add-description-to-dirtytime_expire_seconds.patch thp-use-mm_file_counter-to-determine-update-which-rss-counter.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html