Message ID | 20210318110658.60892-4-songmuchun@bytedance.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Use obj_cgroup APIs to charge kmem pages | expand |
On Thu, Mar 18, 2021 at 07:06:56PM +0800, Muchun Song wrote: > 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@bytedance.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
On Thu, Mar 18, 2021 at 4:08 AM Muchun Song <songmuchun@bytedance.com> wrote: > > 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@bytedance.com> Reviewed-by: Shakeel Butt <shakeelb@google.com>
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); }
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@bytedance.com> --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)