lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <bda30291-ab04-4b72-89c1-b4cb4373cfce@suse.cz> Date: Mon, 9 Sep 2024 09:59:17 +0200 From: Vlastimil Babka <vbabka@...e.cz> To: Yosry Ahmed <yosryahmed@...gle.com> Cc: Shakeel Butt <shakeel.butt@...ux.dev>, Andrew Morton <akpm@...ux-foundation.org>, Johannes Weiner <hannes@...xchg.org>, Michal Hocko <mhocko@...nel.org>, Roman Gushchin <roman.gushchin@...ux.dev>, Muchun Song <muchun.song@...ux.dev>, David Rientjes <rientjes@...gle.com>, Hyeonggon Yoo <42.hyeyoo@...il.com>, Eric Dumazet <edumazet@...gle.com>, "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, linux-mm@...ck.org, linux-kernel@...r.kernel.org, Meta kernel team <kernel-team@...a.com>, cgroups@...r.kernel.org, netdev@...r.kernel.org Subject: Re: [PATCH v4] memcg: add charging of already allocated slab objects 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.
Powered by blists - more mailing lists