]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm/slab: allow specifying free pointer offset when using constructor
authorHarry Yoo <harry.yoo@oracle.com>
Tue, 13 Jan 2026 06:18:38 +0000 (15:18 +0900)
committerVlastimil Babka <vbabka@suse.cz>
Wed, 4 Feb 2026 09:05:35 +0000 (10:05 +0100)
commita13b68d79d5caa5ec0d34b4c0fb2dedf3259fc32
treebd6e49cb72b4e644a6e49487baacadd2557f2760
parentb85f369b81aed457acbea4ad3314218254a72fd2
mm/slab: allow specifying free pointer offset when using constructor

When a slab cache has a constructor, the free pointer is placed after the
object because certain fields must not be overwritten even after the
object is freed.

However, some fields that the constructor does not initialize can safely
be overwritten after free. Allow specifying the free pointer offset within
the object, reducing the overall object size when some fields can be reused
for the free pointer.

Adjust the document accordingly.

Signed-off-by: Harry Yoo <harry.yoo@oracle.com>
Link: https://patch.msgid.link/20260113061845.159790-3-harry.yoo@oracle.com
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/slab.h
mm/slab_common.c
mm/slub.c