]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/slab: call kmalloc_noprof() unconditionally in kmalloc_array_noprof()
authorYe Bin <yebin10@huawei.com>
Sat, 1 Mar 2025 08:37:20 +0000 (16:37 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Wed, 5 Mar 2025 09:03:31 +0000 (10:03 +0100)
commit939c5de3c70d145d7388db1b04d75cda79297c23
treeccbb0f2aa0af9dd1b6d6a4fb8e782af5828dffdd
parenta6687c8ff613fc13a71ce1390593ba8d27c52db9
mm/slab: call kmalloc_noprof() unconditionally in kmalloc_array_noprof()

If 'n' or 'size' isn't builtin constant, we used to call __kmalloc()
before commit 7bd230a26648 ("mm/slab: enable slab allocation tagging for
kmalloc and friends"), which inadvertedly changed both paths to
kmalloc_noprof().

As Harry Yoo points out we can just call kmalloc_noprof()
unconditionally. If the compiler knows n and size are constants it
doesn't guarantee that bytes will be also seen as constant, and that is
the important test in kmalloc_noprof() anyway, so we can just defer to
it always.

[ vbabka@suse.cz: change as Harry suggested and adjust commit log ]

Fixes: 7bd230a26648 ("mm/slab: enable slab allocation tagging for kmalloc and friends")
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/slab.h