[PATCH v4 3/5] mm: memcontrol: change ug->dummy_page only if memcg changed

From: Muchun Song
Date: Thu Mar 18 2021 - 07:09:42 EST


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.

Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index fc22da9805fb..104bddf21314 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6845,6 +6845,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);
@@ -6858,7 +6859,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);
}
--
2.11.0