[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1561507361-59349-3-git-send-email-yang.shi@linux.alibaba.com>
Date: Wed, 26 Jun 2019 08:02:39 +0800
From: Yang Shi <yang.shi@...ux.alibaba.com>
To: kirill.shutemov@...ux.intel.com, ktkhai@...tuozzo.com,
hannes@...xchg.org, mhocko@...e.com, hughd@...gle.com,
shakeelb@...gle.com, rientjes@...gle.com, akpm@...ux-foundation.org
Cc: yang.shi@...ux.alibaba.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: [v4 PATCH 2/4] mm: move mem_cgroup_uncharge out of __page_cache_release()
The later patch would make 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.
Suggested-by: "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: Kirill Tkhai <ktkhai@...tuozzo.com>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Hugh Dickins <hughd@...gle.com>
Cc: Shakeel Butt <shakeelb@...gle.com>
Cc: David Rientjes <rientjes@...gle.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Signed-off-by: Yang Shi <yang.shi@...ux.alibaba.com>
---
mm/page_alloc.c | 1 +
mm/swap.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6c9cf1e..53a7a6c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -624,6 +624,7 @@ static void bad_page(struct page *page, const char *reason,
void free_compound_page(struct page *page)
{
+ mem_cgroup_uncharge(page);
__free_pages_ok(page, compound_order(page));
}
diff --git a/mm/swap.c b/mm/swap.c
index 7ede3ed..170a725 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -71,12 +71,12 @@ static void __page_cache_release(struct page *page)
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);
}
--
1.8.3.1
Powered by blists - more mailing lists