Commit 7ab345a8 authored by Muchun Song's avatar Muchun Song Committed by Linus Torvalds

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/20210319163821.20704-5-songmuchun@bytedance.comSigned-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 48060834
...@@ -6843,6 +6843,7 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) ...@@ -6843,6 +6843,7 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug)
uncharge_gather_clear(ug); uncharge_gather_clear(ug);
} }
ug->memcg = page_memcg(page); ug->memcg = page_memcg(page);
ug->dummy_page = page;
/* pairs with css_put in uncharge_batch */ /* pairs with css_put in uncharge_batch */
css_get(&ug->memcg->css); css_get(&ug->memcg->css);
...@@ -6856,7 +6857,6 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) ...@@ -6856,7 +6857,6 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug)
else else
ug->pgpgout++; ug->pgpgout++;
ug->dummy_page = page;
page->memcg_data = 0; page->memcg_data = 0;
css_put(&ug->memcg->css); css_put(&ug->memcg->css);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment