On Wed, Jul 22, 2020 at 11:05:14AM +0200, Carlos Maiolino wrote: > Use kmem_cache_alloc() directly. > > All kmem_zone_alloc() users pass 0 as flags, which are translated into: > GFP_KERNEL | __GFP_NOWARN, and kmem_zone_alloc() loops forever until the > allocation succeeds. > > We can use __GFP_NOFAIL to tell the allocator to loop forever rather > than doing it ourself, and because the allocation will never fail, we do > not need to use __GFP_NOWARN anymore. Hence, all callers can be > converted to use GFP_KERNEL | __GFP_NOFAIL > > Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx> > --- > > Changelog: > V2: > - Wire up xfs_inode_alloc to use __GFP_NOFAIL > if it's called inside a transaction > - Rewrite changelog in a more decent way. > V3: > - Use __GFP_NOFAIL unconditionally in xfs_inode_alloc(), > use of PF_FSTRANS will be added when the patch re-adding > it is moved to mainline. > > fs/xfs/libxfs/xfs_alloc.c | 3 ++- > fs/xfs/libxfs/xfs_bmap.c | 3 ++- > fs/xfs/xfs_icache.c | 10 ++-------- > 3 files changed, 6 insertions(+), 10 deletions(-) Looks fine with or without the comment as christoph noted. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx