xfs: remove the kmalloc to page allocator fallback
authorChristoph Hellwig <hch@lst.de>
Mon, 10 Mar 2025 13:19:09 +0000 (14:19 +0100)
committerCarlos Maiolino <cem@kernel.org>
Mon, 10 Mar 2025 13:29:44 +0000 (14:29 +0100)
commit4ef39828318220f11050984fb8dbc372c9c03960
tree7ee0b49165f12ff0904245d45d5050d016f5eef8
parent50a524e0ef9be0e862207fc822ab4b7dcb0c4310
xfs: remove the kmalloc to page allocator fallback

Since commit 59bb47985c1d ("mm, sl[aou]b: guarantee natural alignment
for kmalloc(power-of-two)", kmalloc and friends guarantee that power of
two sized allocations are naturally aligned.  Limit our use of kmalloc
for buffers to these power of two sizes and remove the fallback to
the page allocator for this case, but keep a check in addition to
trusting the slab allocator to get the alignment right.

Also refactor the kmalloc path to reuse various calculations for the
size and gfp flags.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_buf.c