lkml.org 
[lkml]   [2022]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 09/11] mm: memcontrol: use obj_cgroup APIs to charge the LRU pages
On Mon, May 30, 2022 at 03:49:17PM +0800, Muchun Song wrote:
> 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 <songmuchun@bytedance.com>

Aside from two questions, which I raised in the comments to previous patches
in the series:
1) perf impact,
2) should we open-code the reparenting procedure to show the locking in a more
explicit ways?

Acked-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!

\
 
 \ /
  Last update: 2022-06-19 22:33    [W:0.507 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site