[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240604102924.u6n35x4rfzdvis3l@quentin>
Date: Tue, 4 Jun 2024 10:29:24 +0000
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: david@...morbit.com, chandan.babu@...cle.com, akpm@...ux-foundation.org,
brauner@...nel.org, djwong@...nel.org, linux-kernel@...r.kernel.org,
hare@...e.de, john.g.garry@...cle.com, gost.dev@...sung.com,
yang@...amperecomputing.com, p.raghav@...sung.com,
cl@...amperecomputing.com, linux-xfs@...r.kernel.org, hch@....de,
mcgrof@...nel.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v6 05/11] mm: split a folio in minimum folio order chunks
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
Powered by blists - more mailing lists