From: Vlastimil Babka <vbabka@suse.cz>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
David Rientjes <rientjes@google.com>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Meta kernel team <kernel-team@meta.com>,
cgroups@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v4] memcg: add charging of already allocated slab objects
Date: Mon, 9 Sep 2024 09:59:17 +0200 [thread overview]
Message-ID: <bda30291-ab04-4b72-89c1-b4cb4373cfce@suse.cz> (raw)
In-Reply-To: <CAJD7tkZNGETjvuA97=PGy-MfmF--n6GdSfOCHboScP+wN1gTag@mail.gmail.com>
On 9/6/24 19:38, Yosry Ahmed wrote:
>> But in case of kmalloc() the allocation must have been still attempted with
>> __GFP_ACCOUNT so a kmalloc-cg cache is used even if the charging fails.
>
> It is still possible that the initial allocation did not have
> __GFP_ACCOUNT, but not from a KMALLOC_NORMAL cache (e.g. KMALLOC_DMA
> or KMALLOC_RECLAIM). In this case kmem_cache_charge() should still
> work, right?
Yeah it would work, but that's rather a corner case implementation detail so
it's better to just require __GFP_ACCOUNT for kmalloc() in the comment.
>>
>> If there's another usage for kmem_cache_charge() where the memcg is
>> available but we don't want to charge immediately on purpose (such as the
>> Linus' idea for struct file), we might need to find another way to tell
>> kmalloc() to use the kmalloc-cg cache but not charge immediately...
>
> Can we just use a dedicated kmem_cache for this instead?
Right, as Shakeel mentioned, that would be the case of struct file. If all
such cases in the future are fine with dedicated cache (i.e. not variable
sized allocations), it should be fine.
next prev parent reply other threads:[~2024-09-09 7:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 17:34 Shakeel Butt
2024-09-05 17:48 ` Yosry Ahmed
2024-09-05 18:48 ` Shakeel Butt
2024-09-06 8:52 ` Vlastimil Babka
2024-09-06 16:03 ` Shakeel Butt
2024-09-06 17:19 ` Yosry Ahmed
2024-09-06 17:28 ` Vlastimil Babka
2024-09-06 17:38 ` Yosry Ahmed
2024-09-09 7:59 ` Vlastimil Babka [this message]
2024-09-09 17:20 ` Yosry Ahmed
2024-09-06 19:04 ` Shakeel Butt
2024-09-10 8:26 ` Paolo Abeni
2024-09-10 9:19 ` Vlastimil Babka
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=bda30291-ab04-4b72-89c1-b4cb4373cfce@suse.cz \
--to=vbabka@suse.cz \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=yosryahmed@google.com \
/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