On Wed 27-02-19 16:12:30, Laura Abbott wrote: > On 2/26/19 6:29 AM, Christoph Hellwig wrote: > > I don't think this is a good idea. The whole concept of just passing > > random GFP_ flags to dma_alloc_attrs / dma_alloc_coherent can't work, > > given that on many architectures we need to set up new page tables > > to remap the allocated memory, and we can't use arbitrary gfp flags > > for pte allocations. > > > > So instead of trying to pass them further down again we need to instead > > work to fix all callers of dma_alloc_attrs / dma_alloc_coherent > > that don't just pass GFP_KERNEL. > > > > What's the expected approach to fix callers? It's not clear how > you would fix the callers for the case that prompted this series > (context correctly used GFP_NOIO but it was not passed to > dma_alloc_coherent) Use the scope API (memalloc_noio_{save,restore}) at the scope boundary (lock or other restriction that prohibids IO path recursion) and you do not have to care about the specific allocation because it will inherit GFP_IO automagically. -- Michal Hocko SUSE Labs