From: Alex Shi <seakeel@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>,
Suren Baghdasaryan <surenb@google.com>,
roman.gushchin@linux.dev
Cc: alexs@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Randy Dunlap <rdunlap@infradead.org>,
Yoann Congal <yoann.congal@smile.fr>,
Masahiro Yamada <masahiroy@kernel.org>,
Petr Mladek <pmladek@suse.com>
Subject: Re: [REF PATCH v3 2/2] mm/slab: decouple the SLAB_OBJ_EXT from MEMCG
Date: Mon, 15 Jul 2024 09:32:06 +0800 [thread overview]
Message-ID: <e6f0927e-6c0b-4983-b539-61527882098d@gmail.com> (raw)
In-Reply-To: <659f204e-de5c-441a-90de-4a7cbfcabe69@suse.cz>
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!
next prev parent reply other threads:[~2024-07-15 1:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-10 5:43 [PATCH v3 1/2] mm/memcg: alignment memcg_data define condition alexs
2024-07-10 5:43 ` [REF PATCH v3 2/2] mm/slab: decouple the SLAB_OBJ_EXT from MEMCG alexs
2024-07-10 6:13 ` Alex Shi
2024-07-11 8:11 ` Vlastimil Babka
2024-07-11 11:49 ` Alex Shi
2024-07-11 13:55 ` Suren Baghdasaryan
2024-07-12 4:21 ` Alex Shi
2024-07-12 7:27 ` Vlastimil Babka
2024-07-15 1:32 ` Alex Shi [this message]
2024-07-11 8:13 ` [PATCH v3 1/2] mm/memcg: alignment memcg_data define condition Vlastimil Babka
2024-07-11 11:51 ` Alex Shi
2024-07-11 14:55 ` Suren Baghdasaryan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6f0927e-6c0b-4983-b539-61527882098d@gmail.com \
--to=seakeel@gmail.com \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=masahiroy@kernel.org \
--cc=penberg@kernel.org \
--cc=pmladek@suse.com \
--cc=rdunlap@infradead.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=yoann.congal@smile.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox