Re: [PATCH 1/2] mm/readahead: stop readahead loop if memcg charge fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 01, 2024 at 02:52:31PM +0100, Jan Kara wrote:
> On Thu 01-02-24 13:47:03, Matthew Wilcox wrote:
> > 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 ;-)
> 
> There's a read_pages() call just outside of the loop so this break is
> actually fine AFAICT.

Oh, good point!  I withdraw my criticism.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux