linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Purpose of maple_node objects to be its size aligned
@ 2024-01-23 11:03 Charan Teja Kalla
  2024-01-23 13:26 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Charan Teja Kalla @ 2024-01-23 11:03 UTC (permalink / raw)
  To: Liam.Howlett, Matthew Wilcox; +Cc: linux-mm, LKML

I am just curious about the purpose of maple node slab objects to be its
size aligned, but I can understand why they need to be cache aligned.

void __init maple_tree_init(void)
{
	maple_node_cache = kmem_cache_create("maple_node",
			sizeof(struct maple_node),
			sizeof(struct maple_node),// Alignment of the slab object.
			SLAB_PANIC, NULL);
}

Reason for the ask is, when slub debug enabled with option Z, the change
[1] makes the total object to be 256 * 3 (=768)bytes.  This turns out to
be a problem in debug builds where the unreclaimable slab consumption
itself is very high thus exerting the memory pressure on the system.

maple_node:
  orginal object size 	   = 256b
  after slub_debug enabled = 768b


If, there is no special requirement, other than just needs to be cache
aligned, thinking of the below:

--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -6283,8 +6283,8 @@ bool mas_nomem(struct ma_state *mas, gfp_t gfp)
 void __init maple_tree_init(void)
 {
        maple_node_cache = kmem_cache_create("maple_node",
-                       sizeof(struct maple_node), sizeof(struct
maple_node),
-                       SLAB_PANIC, NULL);
+                       sizeof(struct maple_node), 0,
+                       SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
 }


[1]d86bd1bece6f ("mm/slub: support left redzone")

Thanks,
charan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-23 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 11:03 Purpose of maple_node objects to be its size aligned Charan Teja Kalla
2024-01-23 13:26 ` Matthew Wilcox
2024-01-23 14:40   ` Charan Teja Kalla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox