aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuchun Song <[email protected]>2021-04-29 22:56:48 -0700
committerLinus Torvalds <[email protected]>2021-04-30 11:20:38 -0700
commit7ab345a8973017c89a1be87b6c8722d1fee1fd95 (patch)
tree84f5bb5a3c4f4884b768227c0d7197a5f70b8b28
parent48060834f2277374bb68c04c62de8b57e769f701 (diff)
mm: memcontrol: change ug->dummy_page only if memcg changed
Just like assignment to ug->memcg, we only need to update ug->dummy_page if memcg changed. So move it to there. This is a very small optimization. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Muchun Song <[email protected]> Acked-by: Johannes Weiner <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Vladimir Davydov <[email protected]> Cc: Xiongchun Duan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/memcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0f77608e89ca..85fd2d86d23f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6843,6 +6843,7 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug)
uncharge_gather_clear(ug);
}
ug->memcg = page_memcg(page);
+ ug->dummy_page = page;
/* pairs with css_put in uncharge_batch */
css_get(&ug->memcg->css);
@@ -6856,7 +6857,6 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug)
else
ug->pgpgout++;
- ug->dummy_page = page;
page->memcg_data = 0;
css_put(&ug->memcg->css);
}