[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e6f0927e-6c0b-4983-b539-61527882098d@gmail.com>
Date: Mon, 15 Jul 2024 09:32:06 +0800
From: Alex Shi <seakeel@...il.com>
To: Vlastimil Babka <vbabka@...e.cz>, Suren Baghdasaryan <surenb@...gle.com>,
roman.gushchin@...ux.dev
Cc: alexs@...nel.org, Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>, Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>, Joonsoo Kim <iamjoonsoo.kim@....com>,
Hyeonggon Yoo <42.hyeyoo@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Randy Dunlap <rdunlap@...radead.org>,
Yoann Congal <yoann.congal@...le.fr>, Masahiro Yamada
<masahiroy@...nel.org>, Petr Mladek <pmladek@...e.com>
Subject: Re: [REF PATCH v3 2/2] mm/slab: decouple the SLAB_OBJ_EXT from MEMCG
On 7/12/24 3:27 PM, Vlastimil Babka wrote:
>> I checked the history of slab for this part. It introduced
>> from commit 10befea91b61c ("mm: memcg/slab: use a single set of kmem_caches for all allocations")
>> But still don't know why !page_has_obj_cgroups followed by memcg_alloc_page_obj_cgroups. Anyone like
>> to give a hints?
>>
>> page = virt_to_head_page(p[i]);
>> +
>> + if (!page_has_obj_cgroups(page) &&
>> + memcg_alloc_page_obj_cgroups(page, s, flags)) {
>> + obj_cgroup_uncharge(objcg, obj_full_size(s));
>> + continue;
>> + }
> I'm not sure I understand your question. The code is trying to charge the
> allocation to a memcg and use the objext.memcg to associate that memcg to
> the object so it can be properly uncharged when freeing.
> When it's the first object in the particular slab page to be charged, the
> objext may not be yet allocated, so it has has to be allocated at that point.
I see. Thanks for explanation!
Powered by blists - more mailing lists