mm: introduce memalloc_retry_wait()
Various places in the kernel - largely in filesystems - respond to a memory allocation failure by looping around and re-trying. Some of these cannot conveniently use __GFP_NOFAIL, for reasons such as: - a GFP_ATOMIC allocation, which __GFP_NOFAIL doesn't work on - a need to check for the process being signalled between failures - the possibility that other recovery actions could be performed - the allocation is quite deep in support code, and passing down an extra flag to say if __GFP_NOFAIL is wanted would be clumsy. Many of these currently use congestion_wait() which (in almost all cases) simply waits the given timeout - congestion isn't tracked for most devices. It isn't clear what the best delay is for loops, but it is clear that the various filesystems shouldn't be responsible for choosing a timeout. This patch introduces memalloc_retry_wait() with takes on that responsibility. Code that wants to retry a memory allocation can call this function passing...
Showing
- fs/ext4/extents.c 3 additions, 5 deletionsfs/ext4/extents.c
- fs/ext4/inline.c 2 additions, 3 deletionsfs/ext4/inline.c
- fs/ext4/page-io.c 5 additions, 4 deletionsfs/ext4/page-io.c
- fs/f2fs/data.c 2 additions, 2 deletionsfs/f2fs/data.c
- fs/f2fs/gc.c 2 additions, 3 deletionsfs/f2fs/gc.c
- fs/f2fs/inode.c 2 additions, 2 deletionsfs/f2fs/inode.c
- fs/f2fs/node.c 2 additions, 2 deletionsfs/f2fs/node.c
- fs/f2fs/recovery.c 3 additions, 3 deletionsfs/f2fs/recovery.c
- fs/f2fs/segment.c 3 additions, 6 deletionsfs/f2fs/segment.c
- fs/f2fs/super.c 2 additions, 3 deletionsfs/f2fs/super.c
- fs/xfs/kmem.c 1 addition, 2 deletionsfs/xfs/kmem.c
- fs/xfs/xfs_buf.c 1 addition, 1 deletionfs/xfs/xfs_buf.c
- include/linux/sched/mm.h 26 additions, 0 deletionsinclude/linux/sched/mm.h
- net/sunrpc/svc_xprt.c 2 additions, 1 deletionnet/sunrpc/svc_xprt.c
Please register or sign in to comment