Re: [PATCH v3 1/4] mm: memcontrol: introduce obj_cgroup_{un}charge_pages
From: Johannes Weiner <hannes@cmpxchg.org>
Date: 2021-03-11 12:31:38
Also in:
lkml
From: Johannes Weiner <hannes@cmpxchg.org>
Date: 2021-03-11 12:31:38
Also in:
lkml
On Tue, Mar 09, 2021 at 06:07:14PM +0800, Muchun Song wrote:
We know that the unit of slab object charging is bytes, the unit of
kmem page charging is PAGE_SIZE. If we want to reuse obj_cgroup APIs
to charge the kmem pages, we should pass PAGE_SIZE (as third parameter)
to obj_cgroup_charge(). Because the size is already PAGE_SIZE, we can
skip touch the objcg stock. And obj_cgroup_{un}charge_pages() are
introduced to charge in units of page level.
In the later patch, we also can reuse those two helpers to charge or
uncharge a number of kernel pages to a object cgroup. This is just
a code movement without any functional changes.
Signed-off-by: Muchun Song <redacted>
Acked-by: Roman Gushchin <redacted>Acked-by: Johannes Weiner <hannes@cmpxchg.org>