]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
add default_gfp() helper macro and use it in the new *alloc_obj() helpers
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 22 Feb 2026 00:14:11 +0000 (16:14 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 22 Feb 2026 01:09:50 +0000 (17:09 -0800)
commite19e1b480ac73c3e62ffebbca1174f0f511f43e7
tree4f83448fd9923f10b4bc4caff48785df5b1c23b9
parentfa5c82f4d2bbde10e9fd3a32aecacfe3813919ba
add default_gfp() helper macro and use it in the new *alloc_obj() helpers

Most simple allocations use GFP_KERNEL, and with the new allocation
helpers being introduced, let's just take advantage of that to simplify
that default case.

It's a numbers game:

    git grep 'alloc_obj(' |
sed 's/.*\(GFP_[_A-Z]*\).*/\1/' |
sort | uniq -c | sort -n | tail

shows that about 90% of all those new allocator instances just use that
standard GFP_KERNEL.

Those helpers are already macros, and we can easily just make it be the
default case when the gfp argument is missing.

And yes, we could do that for all the legacy interfaces too, but let's
keep it to just the new ones at least for now, since those all got
converted recently anyway, so this is not any "extra" noise outside of
that limited conversion.

And, in fact, I want to do this before doing the -rc1 release, exactly
so that we don't get extra merge conflicts.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/gfp.h
include/linux/slab.h