The patch titled Subject: mm: move mem_cgroup_uncharge out of __page_cache_release() has been added to the -mm tree. Its filename is mm-move-mem_cgroup_uncharge-out-of-__page_cache_release.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-move-mem_cgroup_uncharge-out-of-__page_cache_release.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-move-mem_cgroup_uncharge-out-of-__page_cache_release.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: mm: move mem_cgroup_uncharge out of __page_cache_release() A later patch makes THP deferred split shrinker memcg aware, but it needs page->mem_cgroup information in THP destructor, which is called after mem_cgroup_uncharge() now. So move mem_cgroup_uncharge() from __page_cache_release() to compound page destructor, which is called by both THP and other compound pages except HugeTLB. And call it in __put_single_page() for single order page. Link: http://lkml.kernel.org/r/1565144277-36240-3-git-send-email-yang.shi@xxxxxxxxxxxxxxxxx Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxxxxxxxxx> Suggested-by: "Kirill A . Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Qian Cai <cai@xxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 1 + mm/swap.c | 2 +- mm/vmscan.c | 6 ++---- 3 files changed, 4 insertions(+), 5 deletions(-) --- a/mm/page_alloc.c~mm-move-mem_cgroup_uncharge-out-of-__page_cache_release +++ a/mm/page_alloc.c @@ -670,6 +670,7 @@ out: void free_compound_page(struct page *page) { + mem_cgroup_uncharge(page); __free_pages_ok(page, compound_order(page)); } --- a/mm/swap.c~mm-move-mem_cgroup_uncharge-out-of-__page_cache_release +++ a/mm/swap.c @@ -71,12 +71,12 @@ static void __page_cache_release(struct spin_unlock_irqrestore(&pgdat->lru_lock, flags); } __ClearPageWaiters(page); - mem_cgroup_uncharge(page); } static void __put_single_page(struct page *page) { __page_cache_release(page); + mem_cgroup_uncharge(page); free_unref_page(page); } --- a/mm/vmscan.c~mm-move-mem_cgroup_uncharge-out-of-__page_cache_release +++ a/mm/vmscan.c @@ -1490,10 +1490,9 @@ free_it: * Is there need to periodically free_page_list? It would * appear not as the counts should be low */ - if (unlikely(PageTransHuge(page))) { - mem_cgroup_uncharge(page); + if (unlikely(PageTransHuge(page))) (*get_compound_page_dtor(page))(page); - } else + else list_add(&page->lru, &free_pages); continue; @@ -1914,7 +1913,6 @@ static unsigned noinline_for_stack move_ if (unlikely(PageCompound(page))) { spin_unlock_irq(&pgdat->lru_lock); - mem_cgroup_uncharge(page); (*get_compound_page_dtor(page))(page); spin_lock_irq(&pgdat->lru_lock); } else _ Patches currently in -mm which might be from yang.shi@xxxxxxxxxxxxxxxxx are mm-mempolicy-make-the-behavior-consistent-when-mpol_mf_move-and-mpol_mf_strict-were-specified.patch mm-mempolicy-make-the-behavior-consistent-when-mpol_mf_move-and-mpol_mf_strict-were-specified-v4.patch mm-mempolicy-handle-vma-with-unmovable-pages-mapped-correctly-in-mbind.patch mm-mempolicy-handle-vma-with-unmovable-pages-mapped-correctly-in-mbind-v4.patch mm-thp-extract-split_queue_-into-a-struct.patch mm-move-mem_cgroup_uncharge-out-of-__page_cache_release.patch mm-shrinker-make-shrinker-not-depend-on-memcg-kmem.patch mm-thp-make-deferred-split-shrinker-memcg-aware.patch