提交 4e00be7c 编写于 作者: Z Zhou Guanghui 提交者: Zheng Zengkai

mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg and add nr_pages argument

stable inclusion
from stable-5.10.27
commit 6143a1d193e9ecc18250516594655c5a6fbc3a7b
bugzilla: 51493

--------------------------------

commit be6c8982 upstream.

Rename mem_cgroup_split_huge_fixup to split_page_memcg and explicitly pass
in page number argument.

In this way, the interface name is more common and can be used by
potential users.  In addition, the complete info(memcg and flag) of the
memcg needs to be set to the tail pages.

Link: https://lkml.kernel.org/r/20210304074053.65527-2-zhouguanghui1@huawei.comSigned-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
Reviewed-by: NZi Yan <ziy@nvidia.com>
Reviewed-by: NShakeel Butt <shakeelb@google.com>
Acked-by: NMichal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Hanjun Guo <guohanjun@huawei.com>
Cc: Tianhong Ding <dingtianhong@huawei.com>
Cc: Weilong Chen <chenweilong@huawei.com>
Cc: Rui Xiang <rui.xiang@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NHugh Dickins <hughd@google.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 3beedef8
...@@ -937,9 +937,7 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm, ...@@ -937,9 +937,7 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm,
rcu_read_unlock(); rcu_read_unlock();
} }
#ifdef CONFIG_TRANSPARENT_HUGEPAGE void split_page_memcg(struct page *head, unsigned int nr);
void mem_cgroup_split_huge_fixup(struct page *head);
#endif
#else /* CONFIG_MEMCG */ #else /* CONFIG_MEMCG */
...@@ -1267,7 +1265,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, ...@@ -1267,7 +1265,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
return 0; return 0;
} }
static inline void mem_cgroup_split_huge_fixup(struct page *head) static inline void split_page_memcg(struct page *head, unsigned int nr)
{ {
} }
......
...@@ -2434,7 +2434,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, ...@@ -2434,7 +2434,7 @@ static void __split_huge_page(struct page *page, struct list_head *list,
lruvec = mem_cgroup_page_lruvec(head, pgdat); lruvec = mem_cgroup_page_lruvec(head, pgdat);
/* complete memcg works before add pages to LRU */ /* complete memcg works before add pages to LRU */
mem_cgroup_split_huge_fixup(head); split_page_memcg(head, nr);
if (PageAnon(head) && PageSwapCache(head)) { if (PageAnon(head) && PageSwapCache(head)) {
swp_entry_t entry = { .val = page_private(head) }; swp_entry_t entry = { .val = page_private(head) };
......
...@@ -3268,26 +3268,21 @@ void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size) ...@@ -3268,26 +3268,21 @@ void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size)
#endif /* CONFIG_MEMCG_KMEM */ #endif /* CONFIG_MEMCG_KMEM */
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
/* /*
* Because tail pages are not marked as "used", set it. We're under * Because head->mem_cgroup is not set on tails, set it now.
* pgdat->lru_lock and migration entries setup in all page mappings.
*/ */
void mem_cgroup_split_huge_fixup(struct page *head) void split_page_memcg(struct page *head, unsigned int nr)
{ {
struct mem_cgroup *memcg = head->mem_cgroup; struct mem_cgroup *memcg = head->mem_cgroup;
int i; int i;
if (mem_cgroup_disabled()) if (mem_cgroup_disabled() || !memcg)
return; return;
for (i = 1; i < HPAGE_PMD_NR; i++) { for (i = 1; i < nr; i++)
css_get(&memcg->css);
head[i].mem_cgroup = memcg; head[i].mem_cgroup = memcg;
} css_get_many(&memcg->css, nr - 1);
} }
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
#ifdef CONFIG_MEMCG_SWAP #ifdef CONFIG_MEMCG_SWAP
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册