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: use obj_cgroup APIs to charge the LRU pages
We will reuse the obj_cgroup APIs to charge the LRU pages. Finally,
page->memcg_data will have 2 different meanings.
- For the slab pages, page->memcg_data points to an object cgroups
vector.
- For the kmem pages (exclude the slab pages) and the LRU pages,
page->memcg_data points to an object cgroup.
In this patch, we reuse obj_cgroup APIs to charge LRU pages. In the end,
The page cache cannot prevent long-living objects from pinning the original
memory cgroup in the memory.
At the same time we also changed the rules of page and objcg or memcg
binding stability. The new rules are as follows.
For a page any of the following ensures page and objcg binding stability:
- the page lock
- LRU isolation
- lock_page_memcg()
- exclusive reference
Based on the stable binding of page and objcg, for a page any of the
following ensures page and memcg binding stability:
- objcg_lock
- cgroup_mutex
- the lruvec lock
- the split queue lock (only THP page)
If the caller only want to ensure that the page counters of memcg are
updated correctly, ensure that the binding stability of page and objcg
is sufficient.
Signed-off-by: Muchun Song <[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:
include/linux/memcontrol.h
mm/memcontrol.c
(Due to presence of following commits in UEK-8:
i. 'commit becacb0 mm: memcg: add folio_memcg_check()'
ii. 'commit 074e3e2 memcg: convert get_obj_cgroup_from_page to
get_obj_cgroup_from_folio'
iii. 'commit 1b1e134 mm: memcg: introduce memcontrol-v1.c'
Added code in lruvec reparenting logic to account for multigen LRUs
being used in UEK-8.
Signed-off-by: Imran Khan <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
0 commit comments