On 7/3/22 2:37 AM, Matthew Wilcox wrote: > On Sat, Jul 02, 2022 at 09:43:32AM -0600, Jens Axboe wrote: >> +++ b/mm/filemap.c >> @@ -1988,6 +1988,10 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, >> gfp |= __GFP_WRITE; >> if (fgp_flags & FGP_NOFS) >> gfp &= ~__GFP_FS; >> + if (fgp_flags & FGP_NOWAIT) { >> + gfp &= ~GFP_KERNEL; >> + gfp |= GFP_NOWAIT | __GFP_NOWARN; >> + } > > Wouldn't it be simpler to write: > > if (fgp_flags & FGP_NOWAIT) { > gfp &= ~__GFP_DIRECT_RECLAIM; > gfp |= __GFP_NOWARN; > } That won't clear IO or FS, though? We really just want GFP_NOWAIT | __GFP_NOWARN here, but didn't want to make assumptions on whatever else would be set in gfp already. > (I'd prefer it if the caller passed in the GFP flags that it actually > wants, but looking at the patches that prompted this, that seems rather > annoying to do) Yes me too, but that's a lot of annoying churn... -- Jens Axboe