> > A possible way to fix it is this one-liner, but I am not well versed > > in this area, so someone may end up suggesting a better fix: > > diff --git a/mm/filemap.c b/mm/filemap.c > > index 804d7365680c..9e698a619545 100644 > > --- a/mm/filemap.c > > +++ b/mm/filemap.c > > @@ -1964,7 +1964,7 @@ struct folio *__filemap_get_folio(struct > > address_space *mapping, pgoff_t index, > > do { > > gfp_t alloc_gfp = gfp; > > > > - err = -ENOMEM; > > + err = (fgp_flags & FGP_NOWAIT) ? -ENOMEM : -EAGAIN; > > Sorry, I actually meant this: > + err = (fgp_flags & FGP_NOWAIT) ? -EAGAIN : -ENOMEM; Digging a bit more, I realized a better patch (assuming regression indeed exists) is this one, since it accounts for ENOMEM coming from filemap_add_folio, which might allocate in xas_split_alloc() under same fgp flags: diff --git a/mm/filemap.c b/mm/filemap.c index 804d7365680c..dcf1f57e0a9a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1984,6 +1984,8 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index, folio = NULL; } while (order-- > min_order); + if ((fgp_flags & FGP_NOWAIT) && err == -ENOMEM) + return ERR_PTR(-EAGAIN); if (err == -EEXIST) goto repeat; if (err)