On Tue, Sep 10, 2019 at 05:17:48PM +0200, Ilya Dryomov wrote: > The vmalloc allocator doesn't fully respect the specified gfp mask: > while the actual pages are allocated as requested, the page table pages > are always allocated with GFP_KERNEL. ceph_kvmalloc() may be called > with GFP_NOFS and GFP_NOIO (for ceph and rbd respectively), so this may > result in a deadlock. > > There is no real reason for the current PAGE_ALLOC_COSTLY_ORDER logic, > it's just something that seemed sensible at the time (ceph_kvmalloc() > predates kvmalloc()). kvmalloc() is smarter: in an attempt to reduce > long term fragmentation, it first tries to kmalloc non-disruptively. > > Switch to kvmalloc() and set the respective PF_MEMALLOC_* flag using > the scope API to avoid the deadlock. Note that kvmalloc() needs to be > passed GFP_KERNEL to enable the fallback. If you can please just stop using GFP_NOFS altogether and set PF_MEMALLOC_* for the actual contexts.