You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mm: memcontrol: prepare objcg API for non-kmem usage
Pagecache pages are charged at the allocation time and holding a
reference to the original memory cgroup until being reclaimed.
Depending on the memory pressure, specific patterns of the page
sharing between different cgroups and the cgroup creation and
destruction rates, a large number of dying memory cgroups can be
pinned by pagecache pages. It makes the page reclaim less efficient
and wastes memory.
We can convert LRU pages and most other raw memcg pins to the objcg
direction to fix this problem, and then the page->memcg will always
point to an object cgroup pointer.
Therefore, the infrastructure of objcg no longer only serves
CONFIG_MEMCG_KMEM. In this patch, we move the infrastructure of the
objcg out of the scope of the CONFIG_MEMCG_KMEM so that the LRU pages
can reuse it to charge pages.
We know that the LRU pages are not accounted at the root level. But
the page->memcg_data points to the root_mem_cgroup. So the
page->memcg_data of the LRU pages always points to a valid pointer.
But the root_mem_cgroup dose not have an object cgroup. If we use
obj_cgroup APIs to charge the LRU pages, we should set the
page->memcg_data to a root object cgroup. So we also allocate an
object cgroup for the root_mem_cgroup.
Signed-off-by: Muchun Song <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Reviewed-by: Michal Koutný <[email protected]>
Acked-by: Roman Gushchin <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Orabug: 37405594
Conflicts:
mm/memcontrol.c
(Due to presence of following commits in UEK-8:
i. 'commit e4dde56 mm: multi-gen LRU: per-node lru_gen_folio
lists'
ii. 'commit 9c94bef mm/memcontrol.c: replace cgroup_memory_nokmem
with mem_cgroup_kmem_disabled()'
iii. 'commit 675d6c9 mm: kmem: make memcg keep a reference to the original objcg'
include/linux/memcontrol.h
(Due to presence of 'commit 3a3b7fe mm: remove CONFIG_MEMCG_KMEM' - which removed the
#ifdef from struct mem_cgroup, in UEK-8)
Signed-off-by: Imran Khan <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
0 commit comments