On Thu, Feb 01, 2024 at 06:08:34PM +0800, Liu Shixin wrote: > @@ -247,9 +248,12 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, > folio = filemap_alloc_folio(gfp_mask, 0); > if (!folio) > break; > - if (filemap_add_folio(mapping, folio, index + i, > - gfp_mask) < 0) { > + > + ret = filemap_add_folio(mapping, folio, index + i, gfp_mask); > + if (ret < 0) { > folio_put(folio); > + if (ret == -ENOMEM) > + break; No, that's too early. You've still got a batch of pages which were successfully added; you have to read them. You were only off by one line though ;-) > read_pages(ractl); > ractl->_index++; > i = ractl->_index + ractl->_nr_pages - index - 1; > -- > 2.25.1 > >