Skip to content

Commit be6c898

Browse files
Zhou Guanghuitorvalds
authored andcommitted
mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg and add nr_pages argument
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/[email protected] Signed-off-by: Zhou Guanghui <[email protected]> Acked-by: Johannes Weiner <[email protected]> Reviewed-by: Zi Yan <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Kefeng Wang <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: Tianhong Ding <[email protected]> Cc: Weilong Chen <[email protected]> Cc: Rui Xiang <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 61bf318 commit be6c898

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

include/linux/memcontrol.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,9 +1061,7 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm,
10611061
rcu_read_unlock();
10621062
}
10631063

1064-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1065-
void mem_cgroup_split_huge_fixup(struct page *head);
1066-
#endif
1064+
void split_page_memcg(struct page *head, unsigned int nr);
10671065

10681066
#else /* CONFIG_MEMCG */
10691067

@@ -1400,7 +1398,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
14001398
return 0;
14011399
}
14021400

1403-
static inline void mem_cgroup_split_huge_fixup(struct page *head)
1401+
static inline void split_page_memcg(struct page *head, unsigned int nr)
14041402
{
14051403
}
14061404

mm/huge_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,7 @@ static void __split_huge_page(struct page *page, struct list_head *list,
24672467
int i;
24682468

24692469
/* complete memcg works before add pages to LRU */
2470-
mem_cgroup_split_huge_fixup(head);
2470+
split_page_memcg(head, nr);
24712471

24722472
if (PageAnon(head) && PageSwapCache(head)) {
24732473
swp_entry_t entry = { .val = page_private(head) };

mm/memcontrol.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,24 +3287,21 @@ void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size)
32873287

32883288
#endif /* CONFIG_MEMCG_KMEM */
32893289

3290-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
32913290
/*
3292-
* Because page_memcg(head) is not set on compound tails, set it now.
3291+
* Because page_memcg(head) is not set on tails, set it now.
32933292
*/
3294-
void mem_cgroup_split_huge_fixup(struct page *head)
3293+
void split_page_memcg(struct page *head, unsigned int nr)
32953294
{
32963295
struct mem_cgroup *memcg = page_memcg(head);
32973296
int i;
32983297

3299-
if (mem_cgroup_disabled())
3298+
if (mem_cgroup_disabled() || !memcg)
33003299
return;
33013300

3302-
for (i = 1; i < HPAGE_PMD_NR; i++) {
3303-
css_get(&memcg->css);
3304-
head[i].memcg_data = (unsigned long)memcg;
3305-
}
3301+
for (i = 1; i < nr; i++)
3302+
head[i].memcg_data = head->memcg_data;
3303+
css_get_many(&memcg->css, nr - 1);
33063304
}
3307-
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
33083305

33093306
#ifdef CONFIG_MEMCG_SWAP
33103307
/**

0 commit comments

Comments
 (0)