]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rcu, slab: use a regular callback function for kvfree_rcu
authorVlastimil Babka <vbabka@suse.cz>
Mon, 3 Feb 2025 09:28:49 +0000 (10:28 +0100)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 3 Mar 2025 18:43:51 +0000 (13:43 -0500)
commitd55580cbc1cbf36901b54dab998e974380a35dca
tree4bcd6cf3303f2e6d541a00aa8ca9e1c91c552d56
parent49b375b3c700db26adaf94ae8a3e2361fa79a5d0
rcu, slab: use a regular callback function for kvfree_rcu

RCU has been special-casing callback function pointers that are integers
lower than 4096 as offsets of rcu_head for kvfree() instead. The tree
RCU implementation no longer does that as the batched kvfree_rcu() is
not a simple call_rcu(). The tiny RCU still does, and the plan is also
to make tree RCU use call_rcu() for SLUB_TINY configurations.

Instead of teaching tree RCU again to special case the offsets, let's
remove the special casing completely. Since there's no SLOB anymore, it
is possible to create a callback function that can take a pointer to a
middle of slab object with unknown offset and determine the object's
pointer before freeing it, so implement that as kvfree_rcu_cb().

Large kmalloc and vmalloc allocations are handled simply by aligning
down to page size. For that we retain the requirement that the offset is
smaller than 4096. But we can remove __is_kvfree_rcu_offset() completely
and instead just opencode the condition in the BUILD_BUG_ON() check.

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/rcupdate.h
kernel/rcu/tiny.c
mm/slab.h
mm/slab_common.c
mm/slub.c