Re: [PATCH v6 05/11] mm: split a folio in minimum folio order chunks

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

 



On Mon, Jun 03, 2024 at 01:36:46PM +0100, Matthew Wilcox wrote:
> On Wed, May 29, 2024 at 03:45:03PM +0200, Pankaj Raghav (Samsung) wrote:
> > @@ -3572,14 +3600,19 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start,
> >  
> >  	for (index = off_start; index < off_end; index += nr_pages) {
> >  		struct folio *folio = filemap_get_folio(mapping, index);
> > +		unsigned int min_order, target_order = new_order;
> >  
> >  		nr_pages = 1;
> >  		if (IS_ERR(folio))
> >  			continue;
> >  
> > -		if (!folio_test_large(folio))
> > +		if (!folio->mapping || !folio_test_large(folio))
> >  			goto next;
> 
> This check is useless.  folio->mapping is set to NULL on truncate,
> but you haven't done anything to prevent truncate yet.  That happens
> later when you lock the folio.
> 
> > +		min_order = mapping_min_folio_order(mapping);
> 
> You should hoist this out of the loop.
> 
> > +		if (new_order < min_order)
> > +			target_order = min_order;
> > +
> >  		total++;
> >  		nr_pages = folio_nr_pages(folio);
> >  
> > @@ -3589,7 +3622,18 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start,
> >  		if (!folio_trylock(folio))
> >  			goto next;
> >  
> > -		if (!split_folio_to_order(folio, new_order))
> > +		if (!folio_test_anon(folio)) {
> 
> Please explain how a folio _in a file_ can be anon?
> 
> > +			unsigned int min_order;
> > +
> > +			if (!folio->mapping)
> > +				goto next;
> > +
> > +			min_order = mapping_min_folio_order(folio->mapping);
> > +			if (new_order < target_order)
> > +				target_order = min_order;
> 
> Why is this being repeated?
> 
> > +		}

You are right. There are some repetition and checks that are not needed.
I will clean this function for the next revision. 

Thanks.

--
Pankaj




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux