* [PATCH slab/for-next v2 01/14] mm/slab: allow passing SLAB_MAY_ACCOUNT to kmem_cache_create()
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 02/14] lib/maple_tree: specify SLAB_MAY_ACCOUNT for maple_node cache Harry Yoo (Meta)
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
Callers will specify SLAB_MAY_ACCOUNT for caches whose objects may be
allocated with __GFP_ACCOUNT. Accept the flag in SLAB_CORE_FLAGS.
SLAB_MAY_ACCOUNT prevents merging but is not part of the sysfs ID. This
was fine while all mergeable caches had the flag. Now that callers may
specify it, encode it in create_unique_id() to keep the ID unique.
Define the flag in tools/ as well to avoid breaking the userspace tests.
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
mm/slab.h | 2 +-
mm/slub.c | 2 ++
tools/include/linux/slab.h | 3 +++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/mm/slab.h b/mm/slab.h
index 47a6cc8b22ff..168c394ac73f 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -484,7 +484,7 @@ void flush_rcu_sheaves_on_cache(struct kmem_cache *s);
SLAB_CACHE_DMA32 | SLAB_PANIC | \
SLAB_TYPESAFE_BY_RCU | SLAB_DEBUG_OBJECTS | \
SLAB_NOLEAKTRACE | SLAB_RECLAIM_ACCOUNT | \
- SLAB_TEMPORARY | SLAB_ACCOUNT | \
+ SLAB_TEMPORARY | SLAB_ACCOUNT | SLAB_MAY_ACCOUNT | \
SLAB_NO_USER_FLAGS | SLAB_KMALLOC | SLAB_NO_MERGE)
#define SLAB_DEBUG_FLAGS (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
diff --git a/mm/slub.c b/mm/slub.c
index 47a664427c50..3187e78e2e09 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -9833,6 +9833,8 @@ static char *create_unique_id(struct kmem_cache *s)
*p++ = 'a';
if (s->flags & SLAB_ACCOUNT)
*p++ = 'A';
+ if (s->flags & SLAB_MAY_ACCOUNT)
+ *p++ = 'M';
if (s->flags & SLAB_DEBUG_NOOP)
*p++ = 'N';
if (p != name + 1)
diff --git a/tools/include/linux/slab.h b/tools/include/linux/slab.h
index 2e63c2e726aa..104f962ae6f2 100644
--- a/tools/include/linux/slab.h
+++ b/tools/include/linux/slab.h
@@ -15,6 +15,7 @@ enum _slab_flag_bits {
_SLAB_PANIC,
_SLAB_TYPESAFE_BY_RCU,
_SLAB_ACCOUNT,
+ _SLAB_MAY_ACCOUNT,
_SLAB_FLAGS_LAST_BIT
};
@@ -26,8 +27,10 @@ enum _slab_flag_bits {
#define SLAB_TYPESAFE_BY_RCU __SLAB_FLAG_BIT(_SLAB_TYPESAFE_BY_RCU)
#ifdef CONFIG_MEMCG
# define SLAB_ACCOUNT __SLAB_FLAG_BIT(_SLAB_ACCOUNT)
+# define SLAB_MAY_ACCOUNT __SLAB_FLAG_BIT(_SLAB_MAY_ACCOUNT)
#else
# define SLAB_ACCOUNT __SLAB_FLAG_UNUSED
+# define SLAB_MAY_ACCOUNT __SLAB_FLAG_UNUSED
#endif
void *kmalloc(size_t size, gfp_t gfp);
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 02/14] lib/maple_tree: specify SLAB_MAY_ACCOUNT for maple_node cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 01/14] mm/slab: allow passing SLAB_MAY_ACCOUNT to kmem_cache_create() Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 03/14] lib/xarray: specify SLAB_MAY_ACCOUNT for radix_tree_node cache Harry Yoo (Meta)
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, maple-tree
Maple tree users can pass accounted gfp flags down to node allocations
(e.g. arm64 KVM's smccc_filter uses GFP_KERNEL_ACCOUNT). Specify
SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: mtree_insert_range(GFP_KERNEL_ACCOUNT) -> mas_nomem()
-> mas_alloc_nodes() -> kmem_cache_alloc(maple_node_cache)
Cc: "Liam R. Howlett" <liam@infradead.org>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: maple-tree@lists.infradead.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
lib/maple_tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index f7f51f1b40d9..5ff176f1a021 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5815,7 +5815,7 @@ void __init maple_tree_init(void)
maple_node_cache = kmem_cache_create("maple_node",
sizeof(struct maple_node), &args,
- SLAB_PANIC);
+ SLAB_PANIC | SLAB_MAY_ACCOUNT);
}
/**
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 03/14] lib/xarray: specify SLAB_MAY_ACCOUNT for radix_tree_node cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 01/14] mm/slab: allow passing SLAB_MAY_ACCOUNT to kmem_cache_create() Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 02/14] lib/maple_tree: specify SLAB_MAY_ACCOUNT for maple_node cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 04/14] fs/buffer: specify SLAB_MAY_ACCOUNT for buffer_head cache Harry Yoo (Meta)
` (11 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
XArrays with XA_FLAGS_ACCOUNT (e.g. the page cache) allocate nodes with
__GFP_ACCOUNT, and xarray/IDR callers can also pass GFP_KERNEL_ACCOUNT
directly. Specify SLAB_MAY_ACCOUNT when the object may be charged to a
memcg. __GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: __filemap_add_folio() (i_pages has XA_FLAGS_ACCOUNT)
-> xas_store() -> xas_alloc() (gfp |= __GFP_ACCOUNT)
-> kmem_cache_alloc_lru(radix_tree_node_cachep)
Cc: Matthew Wilcox <willy@infradead.org>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
lib/radix-tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 976b9bd02a1b..2c7531deb0df 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -1600,7 +1600,7 @@ void __init radix_tree_init(void)
BUILD_BUG_ON(XA_CHUNK_SIZE > 255);
radix_tree_node_cachep = kmem_cache_create("radix_tree_node",
sizeof(struct radix_tree_node), 0,
- SLAB_PANIC | SLAB_RECLAIM_ACCOUNT,
+ SLAB_PANIC | SLAB_RECLAIM_ACCOUNT | SLAB_MAY_ACCOUNT,
radix_tree_node_ctor);
ret = cpuhp_setup_state_nocalls(CPUHP_RADIX_DEAD, "lib/radix:dead",
NULL, radix_tree_cpu_dead);
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 04/14] fs/buffer: specify SLAB_MAY_ACCOUNT for buffer_head cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (2 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 03/14] lib/xarray: specify SLAB_MAY_ACCOUNT for radix_tree_node cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-26 9:05 ` Jan Kara
2026-11-25 21:37 ` [PATCH slab/for-next v2 05/14] net: skbuff: specify SLAB_MAY_ACCOUNT for skbuff_head_cache Harry Yoo (Meta)
` (10 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
Buffer heads are allocated with __GFP_ACCOUNT to charge them to the
memcg of the folio they are attached to. Specify SLAB_MAY_ACCOUNT when
the object may be charged to a memcg. __GFP_ACCOUNT without
SLAB_MAY_ACCOUNT will not be allowed.
Path: ext4_getblk() -> folio_alloc_buffers(GFP_NOFS | __GFP_ACCOUNT)
-> alloc_buffer_head() -> kmem_cache_zalloc(bh_cachep)
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
fs/buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index f951559e7d32..4c24f4546106 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3006,7 +3006,7 @@ void __init buffer_init(void)
int ret;
bh_cachep = KMEM_CACHE(buffer_head,
- SLAB_RECLAIM_ACCOUNT|SLAB_PANIC);
+ SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MAY_ACCOUNT);
/*
* Limit the bh occupancy to 10% of ZONE_NORMAL
*/
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH slab/for-next v2 04/14] fs/buffer: specify SLAB_MAY_ACCOUNT for buffer_head cache
2026-11-25 21:37 ` [PATCH slab/for-next v2 04/14] fs/buffer: specify SLAB_MAY_ACCOUNT for buffer_head cache Harry Yoo (Meta)
@ 2026-11-26 9:05 ` Jan Kara
0 siblings, 0 replies; 19+ messages in thread
From: Jan Kara @ 2026-11-26 9:05 UTC (permalink / raw)
To: Harry Yoo (Meta)
Cc: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin,
Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Liam R. Howlett, Alice Ryhl, Andrew Ballance, Matthew Wilcox,
linux-fsdevel, Alexander Viro, Christian Brauner, Jan Kara,
David S. Miller, Jakub Kicinski, Sebastian Andrzej Siewior,
Jiayuan Chen, netdev, Kees Cook, David Hildenbrand,
Lorenzo Stoakes, Catalin Marinas, Will Deacon, Mark Rutland,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Robin Murphy, Joerg Roedel (AMD), Amir Goldstein, Casey Schaufler,
Paul Moore, James Morris, Serge E. Hallyn, linux-security-module,
Richard Weinberger, Anton Ivanov, Johannes Berg, Eric Dumazet
On Wed 25-11-26 21:37:05, Harry Yoo (Meta) wrote:
> Buffer heads are allocated with __GFP_ACCOUNT to charge them to the
> memcg of the folio they are attached to. Specify SLAB_MAY_ACCOUNT when
> the object may be charged to a memcg. __GFP_ACCOUNT without
> SLAB_MAY_ACCOUNT will not be allowed.
>
> Path: ext4_getblk() -> folio_alloc_buffers(GFP_NOFS | __GFP_ACCOUNT)
> -> alloc_buffer_head() -> kmem_cache_zalloc(bh_cachep)
>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Christian Brauner <brauner@kernel.org>
> Cc: Jan Kara <jack@suse.cz>
> Cc: linux-fsdevel@vger.kernel.org
> Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
Looks good. Feel free to add:
Acked-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/buffer.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index f951559e7d32..4c24f4546106 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -3006,7 +3006,7 @@ void __init buffer_init(void)
> int ret;
>
> bh_cachep = KMEM_CACHE(buffer_head,
> - SLAB_RECLAIM_ACCOUNT|SLAB_PANIC);
> + SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MAY_ACCOUNT);
> /*
> * Limit the bh occupancy to 10% of ZONE_NORMAL
> */
>
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH slab/for-next v2 05/14] net: skbuff: specify SLAB_MAY_ACCOUNT for skbuff_head_cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (3 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 04/14] fs/buffer: specify SLAB_MAY_ACCOUNT for buffer_head cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 06/14] kernel/fork: specify SLAB_MAY_ACCOUNT for thread_stack cache Harry Yoo (Meta)
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, Paolo Abeni, Simon Horman,
Jason Xing, Willem de Bruijn, Mina Almasry, Björn Töpel
AF_UNIX sets sk->sk_allocation to GFP_KERNEL_ACCOUNT, so skbs can be
allocated from skbuff_head_cache with __GFP_ACCOUNT. Specify
SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: unix_dgram_sendmsg() -> sock_alloc_send_pskb(sk->sk_allocation)
-> alloc_skb_with_frags() -> __alloc_skb()
-> kmem_cache_alloc_node(skbuff_head_cache)
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>
Cc: Jason Xing <kerneljasonxing@gmail.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: "Björn Töpel" <bjorn@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netdev@vger.kernel.org
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
net/core/skbuff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 1ac1e327ac4c..91c076f32fcb 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5313,7 +5313,7 @@ void __init skb_init(void)
sizeof(struct sk_buff),
0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC|
- FLAG_SKB_NO_MERGE,
+ SLAB_MAY_ACCOUNT|FLAG_SKB_NO_MERGE,
offsetof(struct sk_buff, cb),
sizeof_field(struct sk_buff, cb),
NULL);
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 06/14] kernel/fork: specify SLAB_MAY_ACCOUNT for thread_stack cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (4 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 05/14] net: skbuff: specify SLAB_MAY_ACCOUNT for skbuff_head_cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 07/14] arm64/mm: specify SLAB_MAY_ACCOUNT for pgd_cache Harry Yoo (Meta)
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, Mike Rapoport, Michal Hocko,
Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak
When THREAD_SIZE < PAGE_SIZE, thread stacks are allocated from a slab
cache with THREADINFO_GFP, which includes __GFP_ACCOUNT. Specify
SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path (e.g. ppc64le, 64K pages, !VMAP_STACK): copy_process()
-> dup_task_struct() -> alloc_thread_stack_node()
-> kmem_cache_alloc_node(thread_stack_cache, THREADINFO_GFP)
Cc: Kees Cook <kees@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: "Liam R. Howlett" <liam@infradead.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
kernel/fork.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index 5efceb8d58a7..d0e49a81e7cf 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -459,7 +459,8 @@ static void free_thread_stack(struct task_struct *tsk)
void thread_stack_cache_init(void)
{
thread_stack_cache = kmem_cache_create_usercopy("thread_stack",
- THREAD_SIZE, THREAD_SIZE, 0, 0,
+ THREAD_SIZE, THREAD_SIZE,
+ SLAB_MAY_ACCOUNT, 0,
THREAD_SIZE, NULL);
BUG_ON(thread_stack_cache == NULL);
}
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 07/14] arm64/mm: specify SLAB_MAY_ACCOUNT for pgd_cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (5 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 06/14] kernel/fork: specify SLAB_MAY_ACCOUNT for thread_stack cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 08/14] powerpc/mm: specify SLAB_MAY_ACCOUNT for pgtable caches Harry Yoo (Meta)
` (7 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, Anshuman Khandual, linux-arm-kernel
When PGD_SIZE != PAGE_SIZE, user PGDs are allocated from pgd_cache
with GFP_PGTABLE_USER, which includes __GFP_ACCOUNT. Specify
SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path (e.g. 64K pages): copy_process() -> mm_init() -> pgd_alloc()
-> kmem_cache_alloc(pgd_cache, GFP_PGTABLE_USER)
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
arch/arm64/mm/pgd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
index bf5110b91e2f..0fd5b90b5160 100644
--- a/arch/arm64/mm/pgd.c
+++ b/arch/arm64/mm/pgd.c
@@ -63,5 +63,5 @@ void __init pgtable_cache_init(void)
* Naturally aligned pgds required by the architecture.
*/
pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_SIZE,
- SLAB_PANIC, NULL);
+ SLAB_PANIC | SLAB_MAY_ACCOUNT, NULL);
}
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 08/14] powerpc/mm: specify SLAB_MAY_ACCOUNT for pgtable caches
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (6 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 07/14] arm64/mm: specify SLAB_MAY_ACCOUNT for pgd_cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 09/14] iommu: specify SLAB_MAY_ACCOUNT for slab-backed page table caches Harry Yoo (Meta)
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, Christophe Leroy (CS GROUP),
linuxppc-dev
User page tables are allocated from PGT_CACHE() with
pgtable_gfp_flags(), which adds __GFP_ACCOUNT for non-kernel mms.
Specify SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: copy_process() -> mm_init() -> pgd_alloc()
-> kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
pgtable_gfp_flags(mm, GFP_KERNEL))
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
arch/powerpc/mm/init-common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c
index 745097554bea..72dfcc559630 100644
--- a/arch/powerpc/mm/init-common.c
+++ b/arch/powerpc/mm/init-common.c
@@ -140,7 +140,8 @@ void pgtable_cache_add(unsigned int shift)
align = max_t(unsigned long, align, minalign);
name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift);
if (name)
- new = kmem_cache_create(name, table_size, align, 0, ctor(shift));
+ new = kmem_cache_create(name, table_size, align,
+ SLAB_MAY_ACCOUNT, ctor(shift));
if (!new)
panic("Could not allocate pgtable cache for order %d", shift);
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 09/14] iommu: specify SLAB_MAY_ACCOUNT for slab-backed page table caches
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (7 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 08/14] powerpc/mm: specify SLAB_MAY_ACCOUNT for pgtable caches Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 10/14] fanotify: specify SLAB_MAY_ACCOUNT for event caches Harry Yoo (Meta)
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, Niklas Schnelle, Matthew Rosato,
Gerald Schaefer, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
linux-arm-kernel, iommu, linux-s390, linux-sunxi
vfio, iommufd and vhost-vdpa call iommu_map() with GFP_KERNEL_ACCOUNT
and the gfp is passed down to the drivers' page table allocations.
Specify SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Paths:
VFIO_IOMMU_MAP_DMA -> iommu_map(GFP_KERNEL_ACCOUNT)
-> s390_iommu_map_pages() -> dma_walk_cpu_trans()
-> kmem_cache_alloc(dma_{region,page}_table_cache)
iommu_map(GFP_KERNEL_ACCOUNT) -> arm_v7s_map_pages()
-> __arm_v7s_alloc_table() -> kmem_cache_zalloc(data->l2_tables)
iommu_map(GFP_KERNEL_ACCOUNT) -> sun50i_iommu_map()
-> sun50i_dte_get_page_table() -> kmem_cache_zalloc(iommu->pt_pool)
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: "Joerg Roedel (AMD)" <joro@8bytes.org>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Matthew Rosato <mjrosato@linux.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Chen-Yu Tsai <wens@kernel.org>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Samuel Holland <samuel@sholland.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: iommu@lists.linux.dev
Cc: linux-s390@vger.kernel.org
Cc: linux-sunxi@lists.linux.dev
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
drivers/iommu/io-pgtable-arm-v7s.c | 2 +-
drivers/iommu/s390-iommu.c | 4 ++--
drivers/iommu/sun50i-iommu.c | 3 ++-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 1dbef8c55007..b544e5da237a 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -706,7 +706,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
data->l2_tables = kmem_cache_create("io-pgtable_armv7s_l2",
ARM_V7S_TABLE_SIZE(2, cfg),
ARM_V7S_TABLE_SIZE(2, cfg),
- slab_flag, NULL);
+ slab_flag | SLAB_MAY_ACCOUNT, NULL);
if (!data->l2_tables)
goto out_free_data;
diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index a280ad4f63b7..467b97ec18dc 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -198,14 +198,14 @@ static int __init dma_alloc_cpu_table_caches(void)
dma_region_table_cache = kmem_cache_create("PCI_DMA_region_tables",
ZPCI_TABLE_SIZE,
ZPCI_TABLE_ALIGN,
- 0, NULL);
+ SLAB_MAY_ACCOUNT, NULL);
if (!dma_region_table_cache)
return -ENOMEM;
dma_page_table_cache = kmem_cache_create("PCI_DMA_page_tables",
ZPCI_PT_SIZE,
ZPCI_PT_ALIGN,
- 0, NULL);
+ SLAB_MAY_ACCOUNT, NULL);
if (!dma_page_table_cache) {
kmem_cache_destroy(dma_region_table_cache);
return -ENOMEM;
diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
index acdccb7c9eef..604a357cc1fb 100644
--- a/drivers/iommu/sun50i-iommu.c
+++ b/drivers/iommu/sun50i-iommu.c
@@ -1011,7 +1011,8 @@ static int sun50i_iommu_probe(struct platform_device *pdev)
iommu->pt_pool = kmem_cache_create(dev_name(&pdev->dev),
PT_SIZE, PT_SIZE,
- SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA32,
+ SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA32 |
+ SLAB_MAY_ACCOUNT,
NULL);
if (!iommu->pt_pool)
return -ENOMEM;
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 10/14] fanotify: specify SLAB_MAY_ACCOUNT for event caches
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (8 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 09/14] iommu: specify SLAB_MAY_ACCOUNT for slab-backed page table caches Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-26 9:06 ` Jan Kara
2026-11-25 21:37 ` [PATCH slab/for-next v2 11/14] smack: specify SLAB_MAY_ACCOUNT for smack_rule cache Harry Yoo (Meta)
` (4 subsequent siblings)
14 siblings, 1 reply; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
fanotify events are allocated with GFP_KERNEL_ACCOUNT and charged to
the memcg of the listener. Specify SLAB_MAY_ACCOUNT when the object
may be charged to a memcg. __GFP_ACCOUNT without SLAB_MAY_ACCOUNT
will not be allowed.
Path: fsnotify() -> fanotify_handle_event()
-> fanotify_alloc_event(GFP_KERNEL_ACCOUNT)
-> kmem_cache_alloc(fanotify_{fid,path,perm,mnt}_event_cachep)
Cc: Jan Kara <jack@suse.cz>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
fs/notify/fanotify/fanotify_user.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 63c9759fc3b0..3575c681abc1 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -2184,14 +2184,16 @@ static int __init fanotify_user_setup(void)
fanotify_mark_cache = KMEM_CACHE(fanotify_mark,
SLAB_PANIC|SLAB_ACCOUNT);
fanotify_fid_event_cachep = KMEM_CACHE(fanotify_fid_event,
- SLAB_PANIC);
+ SLAB_PANIC|SLAB_MAY_ACCOUNT);
fanotify_path_event_cachep = KMEM_CACHE(fanotify_path_event,
- SLAB_PANIC);
+ SLAB_PANIC|SLAB_MAY_ACCOUNT);
if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) {
fanotify_perm_event_cachep =
- KMEM_CACHE(fanotify_perm_event, SLAB_PANIC);
+ KMEM_CACHE(fanotify_perm_event,
+ SLAB_PANIC|SLAB_MAY_ACCOUNT);
}
- fanotify_mnt_event_cachep = KMEM_CACHE(fanotify_mnt_event, SLAB_PANIC);
+ fanotify_mnt_event_cachep = KMEM_CACHE(fanotify_mnt_event,
+ SLAB_PANIC|SLAB_MAY_ACCOUNT);
fanotify_max_queued_events = FANOTIFY_DEFAULT_MAX_EVENTS;
init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS] =
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH slab/for-next v2 10/14] fanotify: specify SLAB_MAY_ACCOUNT for event caches
2026-11-25 21:37 ` [PATCH slab/for-next v2 10/14] fanotify: specify SLAB_MAY_ACCOUNT for event caches Harry Yoo (Meta)
@ 2026-11-26 9:06 ` Jan Kara
0 siblings, 0 replies; 19+ messages in thread
From: Jan Kara @ 2026-11-26 9:06 UTC (permalink / raw)
To: Harry Yoo (Meta)
Cc: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin,
Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Liam R. Howlett, Alice Ryhl, Andrew Ballance, Matthew Wilcox,
linux-fsdevel, Alexander Viro, Christian Brauner, Jan Kara,
David S. Miller, Jakub Kicinski, Sebastian Andrzej Siewior,
Jiayuan Chen, netdev, Kees Cook, David Hildenbrand,
Lorenzo Stoakes, Catalin Marinas, Will Deacon, Mark Rutland,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Robin Murphy, Joerg Roedel (AMD), Amir Goldstein, Casey Schaufler,
Paul Moore, James Morris, Serge E. Hallyn, linux-security-module,
Richard Weinberger, Anton Ivanov, Johannes Berg, Eric Dumazet
On Wed 25-11-26 21:37:11, Harry Yoo (Meta) wrote:
> fanotify events are allocated with GFP_KERNEL_ACCOUNT and charged to
> the memcg of the listener. Specify SLAB_MAY_ACCOUNT when the object
> may be charged to a memcg. __GFP_ACCOUNT without SLAB_MAY_ACCOUNT
> will not be allowed.
>
> Path: fsnotify() -> fanotify_handle_event()
> -> fanotify_alloc_event(GFP_KERNEL_ACCOUNT)
> -> kmem_cache_alloc(fanotify_{fid,path,perm,mnt}_event_cachep)
>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Amir Goldstein <amir73il@gmail.com>
> Cc: linux-fsdevel@vger.kernel.org
> Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
Looks good. Feel free to add:
Acked-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/notify/fanotify/fanotify_user.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 63c9759fc3b0..3575c681abc1 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -2184,14 +2184,16 @@ static int __init fanotify_user_setup(void)
> fanotify_mark_cache = KMEM_CACHE(fanotify_mark,
> SLAB_PANIC|SLAB_ACCOUNT);
> fanotify_fid_event_cachep = KMEM_CACHE(fanotify_fid_event,
> - SLAB_PANIC);
> + SLAB_PANIC|SLAB_MAY_ACCOUNT);
> fanotify_path_event_cachep = KMEM_CACHE(fanotify_path_event,
> - SLAB_PANIC);
> + SLAB_PANIC|SLAB_MAY_ACCOUNT);
> if (IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS)) {
> fanotify_perm_event_cachep =
> - KMEM_CACHE(fanotify_perm_event, SLAB_PANIC);
> + KMEM_CACHE(fanotify_perm_event,
> + SLAB_PANIC|SLAB_MAY_ACCOUNT);
> }
> - fanotify_mnt_event_cachep = KMEM_CACHE(fanotify_mnt_event, SLAB_PANIC);
> + fanotify_mnt_event_cachep = KMEM_CACHE(fanotify_mnt_event,
> + SLAB_PANIC|SLAB_MAY_ACCOUNT);
>
> fanotify_max_queued_events = FANOTIFY_DEFAULT_MAX_EVENTS;
> init_user_ns.ucount_max[UCOUNT_FANOTIFY_GROUPS] =
>
> --
> 2.54.0
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH slab/for-next v2 11/14] smack: specify SLAB_MAY_ACCOUNT for smack_rule cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (9 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 10/14] fanotify: specify SLAB_MAY_ACCOUNT for event caches Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 12/14] hostfs: specify SLAB_MAY_ACCOUNT for inode cache Harry Yoo (Meta)
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
smk_copy_rules() allocates rules with the gfp passed from
security_prepare_creds(), which is GFP_KERNEL_ACCOUNT. Specify
SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: fork() -> copy_creds() -> prepare_creds()
-> security_prepare_creds(GFP_KERNEL_ACCOUNT) -> smack_cred_prepare()
-> smk_copy_rules() -> kmem_cache_zalloc(smack_rule_cache)
Cc: Casey Schaufler <casey@schaufler-ca.com>
Cc: Paul Moore <paul@paul-moore.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: linux-security-module@vger.kernel.org
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
security/smack/smack_lsm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 3a4a33568297..f4454dc8e232 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -5359,7 +5359,7 @@ static __init int smack_init(void)
struct cred *cred = (struct cred *) current->cred;
struct task_smack *tsp;
- smack_rule_cache = KMEM_CACHE(smack_rule, 0);
+ smack_rule_cache = KMEM_CACHE(smack_rule, SLAB_MAY_ACCOUNT);
if (!smack_rule_cache)
return -ENOMEM;
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 12/14] hostfs: specify SLAB_MAY_ACCOUNT for inode cache
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (10 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 11/14] smack: specify SLAB_MAY_ACCOUNT for smack_rule cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 13/14] mm/memcontrol: do not allow charging objects without SLAB_MAY_ACCOUNT Harry Yoo (Meta)
` (2 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, linux-um
hostfs inodes are allocated with GFP_KERNEL_ACCOUNT. Specify
SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: lookup -> hostfs_iget() -> hostfs_alloc_inode()
-> alloc_inode_sb(sb, hostfs_inode_cache, GFP_KERNEL_ACCOUNT)
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-um@lists.infradead.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
fs/hostfs/hostfs_kern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 613146e76dec..8d748ff838f3 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -1078,7 +1078,7 @@ MODULE_ALIAS_FS("hostfs");
static int __init init_hostfs(void)
{
- hostfs_inode_cache = KMEM_CACHE(hostfs_inode_info, 0);
+ hostfs_inode_cache = KMEM_CACHE(hostfs_inode_info, SLAB_MAY_ACCOUNT);
if (!hostfs_inode_cache)
return -ENOMEM;
return register_filesystem(&hostfs_type);
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 13/14] mm/memcontrol: do not allow charging objects without SLAB_MAY_ACCOUNT
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (11 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 12/14] hostfs: specify SLAB_MAY_ACCOUNT for inode cache Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-25 21:37 ` [PATCH slab/for-next v2 14/14] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches Harry Yoo (Meta)
2026-11-26 11:10 ` [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata sashiko-bot
14 siblings, 0 replies; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet, cgroups
Objects of a cache without SLAB_MAY_ACCOUNT cannot store the objcg
pointer once slabobj_ext space is no longer reserved for every cache.
Skip charging when __GFP_ACCOUNT hits such a cache, and warn once under
CONFIG_DEBUG_VM to catch callers that did not opt in.
Refusing the charge here is sufficient for correctness: an object that
is never charged does not access the objcg slot again, and the free
path already skips such caches via slab_needs_objcg().
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: cgroups@vger.kernel.org
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
mm/memcontrol.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a07cc73acfc7..0eddb16173fd 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3707,6 +3707,12 @@ bool __memcg_slab_post_alloc_hook(struct kmem_cache *s, struct list_lru *lru,
if (unlikely(*p == NULL))
return true;
+ /* Do not allow __GFP_ACCOUNT without SLAB_MAY_ACCOUNT */
+ if (unlikely(!cache_needs_objcg(s))) {
+ VM_WARN_ON_ONCE(1);
+ return true;
+ }
+
flags &= gfp_allowed_mask;
if (lru) {
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH slab/for-next v2 14/14] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (12 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 13/14] mm/memcontrol: do not allow charging objects without SLAB_MAY_ACCOUNT Harry Yoo (Meta)
@ 2026-11-25 21:37 ` Harry Yoo (Meta)
2026-11-26 11:10 ` sashiko-bot
2026-11-26 11:10 ` [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata sashiko-bot
14 siblings, 1 reply; 19+ messages in thread
From: Harry Yoo (Meta) @ 2026-11-25 21:37 UTC (permalink / raw)
To: Vlastimil Babka, Andrew Morton, Suren Baghdasaryan,
Johannes Weiner, Michal Hocko, Shakeel Butt, Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, linux-kernel, kernel-team,
Harry Yoo (Meta), Liam R. Howlett, Alice Ryhl, Andrew Ballance,
Matthew Wilcox, linux-fsdevel, Alexander Viro, Christian Brauner,
Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, netdev, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
Now that all caches whose objects may be allocated with __GFP_ACCOUNT
specify SLAB_MAY_ACCOUNT (or SLAB_ACCOUNT, which implies it), stop
assuming any cache may be used with __GFP_ACCOUNT. This avoids wasting
the objcg slot in slabobj_ext for caches that are never charged to a
memcg.
Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
---
include/linux/slab.h | 16 +++++++++++++---
mm/slab_common.c | 8 +++-----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index ad645967a3ee..8525e70eaa76 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -201,14 +201,24 @@ enum _slab_flag_bits {
/**
* define SLAB_ACCOUNT - Account allocations to memcg.
*
- * All object allocations from this cache will be memcg accounted, regardless of
- * __GFP_ACCOUNT being or not being passed to individual allocations.
+ * All object allocations from this cache will be memcg accounted.
+ * SLAB_ACCOUNT implies SLAB_MAY_ACCOUNT.
*/
#ifdef CONFIG_MEMCG
# define SLAB_ACCOUNT __SLAB_FLAG_BIT(_SLAB_ACCOUNT)
-# define SLAB_MAY_ACCOUNT __SLAB_FLAG_BIT(_SLAB_MAY_ACCOUNT)
#else
# define SLAB_ACCOUNT __SLAB_FLAG_UNUSED
+#endif
+
+/**
+ * define SLAB_MAY_ACCOUNT
+ *
+ * Objects will be memcg accounted when __GFP_ACCOUNT flag is specified.
+ * Requesting __GFP_ACCOUNT allocations without SLAB_MAY_ACCOUNT is not allowed.
+ */
+#ifdef CONFIG_MEMCG
+# define SLAB_MAY_ACCOUNT __SLAB_FLAG_BIT(_SLAB_MAY_ACCOUNT)
+#else
# define SLAB_MAY_ACCOUNT __SLAB_FLAG_UNUSED
#endif
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 193b5a03bc47..464695504248 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -367,12 +367,10 @@ struct kmem_cache *__kmem_cache_create_args(const char *name,
goto out_unlock;
}
- /*
- * For now we assume any cache can be used with __GFP_ACCOUNT and thus
- * may need to store objcg pointers for objects
- */
- if (!mem_cgroup_kmem_disabled())
+ if (flags & SLAB_ACCOUNT)
flags |= SLAB_MAY_ACCOUNT;
+ if (mem_cgroup_kmem_disabled())
+ flags &= ~SLAB_MAY_ACCOUNT;
/* Fail closed on bad usersize of useroffset values. */
if (!IS_ENABLED(CONFIG_HARDENED_USERCOPY) ||
--
2.54.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH slab/for-next v2 14/14] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches
2026-11-25 21:37 ` [PATCH slab/for-next v2 14/14] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches Harry Yoo (Meta)
@ 2026-11-26 11:10 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-26 11:10 UTC (permalink / raw)
To: Harry Yoo (Meta), Vlastimil Babka, Andrew Morton,
Suren Baghdasaryan, Johannes Weiner, Michal Hocko, Shakeel Butt,
Roman Gushchin
Cc: Hao Li, Christoph Lameter, David Rientjes, Muchun Song, Hao Ge,
Pedro Falcato, linux-mm, kernel-team, Liam R. Howlett, Alice Ryhl,
Andrew Ballance, Matthew Wilcox, Alexander Viro,
Christian Brauner, Jan Kara, David S. Miller, Jakub Kicinski,
Sebastian Andrzej Siewior, Jiayuan Chen, Kees Cook,
David Hildenbrand, Lorenzo Stoakes, Catalin Marinas, Will Deacon,
Mark Rutland, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Robin Murphy, Joerg Roedel (AMD), Amir Goldstein,
Casey Schaufler, Paul Moore, James Morris, Serge E. Hallyn,
linux-security-module, Richard Weinberger, Anton Ivanov,
Johannes Berg, Eric Dumazet
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm/slab: missing short description in SLAB_MAY_ACCOUNT
kernel-doc comment
--
commit b34eae19fad88ae1a8ba755676d1139c330f19f8
Author: Harry Yoo (Meta) <harry@kernel.org>
mm/slab: do not set SLAB_MAY_ACCOUNT for all caches
This commit stops unconditionally setting SLAB_MAY_ACCOUNT on all slab
caches and updates the kernel-doc comments for SLAB_ACCOUNT and
SLAB_MAY_ACCOUNT.
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index ad645967a3eea..8525e70eaa76b 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -201,14 +201,24 @@ enum _slab_flag_bits {
> /**
> * define SLAB_ACCOUNT - Account allocations to memcg.
> *
> - * All object allocations from this cache will be memcg accounted, regardless of
> - * __GFP_ACCOUNT being or not being passed to individual allocations.
> + * All object allocations from this cache will be memcg accounted.
> + * SLAB_ACCOUNT implies SLAB_MAY_ACCOUNT.
> */
> #ifdef CONFIG_MEMCG
> # define SLAB_ACCOUNT __SLAB_FLAG_BIT(_SLAB_ACCOUNT)
> -# define SLAB_MAY_ACCOUNT __SLAB_FLAG_BIT(_SLAB_MAY_ACCOUNT)
> #else
> # define SLAB_ACCOUNT __SLAB_FLAG_UNUSED
> +#endif
> +
> +/**
> + * define SLAB_MAY_ACCOUNT
> + *
> + * Objects will be memcg accounted when __GFP_ACCOUNT flag is specified.
> + * Requesting __GFP_ACCOUNT allocations without SLAB_MAY_ACCOUNT is not allowed.
> + */
[Severity: Low]
Should the identifier line for SLAB_MAY_ACCOUNT include a "- <short
description>" suffix, like SLAB_ACCOUNT above? Without it, running
kernel-doc with -Wall or -Wshort-desc warns about a missing initial short
description.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-memalloc-prof-dont-waste-slabobj-ext-metadata-v2-0-7c680f02a734@kernel.org?part=14
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata
2026-11-25 21:37 [PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata Harry Yoo (Meta)
` (13 preceding siblings ...)
2026-11-25 21:37 ` [PATCH slab/for-next v2 14/14] mm/slab: do not set SLAB_MAY_ACCOUNT for all caches Harry Yoo (Meta)
@ 2026-11-26 11:10 ` sashiko-bot
14 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-11-26 11:10 UTC (permalink / raw)
To: Harry Yoo (Meta)
Cc: linux-security-module, linux-s390, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger
Sashiko has finished reviewing this 14-patch series:
- Patches 1-13: no issues found.
- Patch 14 ("mm/slab: do not set SLAB_MAY_ACCOUNT for all caches"): 1
potential issue (1 Low)
A detailed review has been sent as a separate reply to patch 14.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-memalloc-prof-dont-waste-slabobj-ext-metadata-v2-0-7c680f02a734@kernel.org
^ permalink raw reply [flat|nested] 19+ messages in thread