[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240709173305.gb3ffmlja72ypgsd@quentin>
Date: Tue, 9 Jul 2024 17:33:05 +0000
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: david@...morbit.com, ryan.roberts@....com, djwong@...nel.org,
linux-kernel@...r.kernel.org, yang@...amperecomputing.com,
linux-mm@...ck.org, john.g.garry@...cle.com,
linux-fsdevel@...r.kernel.org, hare@...e.de, p.raghav@...sung.com,
mcgrof@...nel.org, gost.dev@...sung.com, cl@...amperecomputing.com,
linux-xfs@...r.kernel.org, hch@....de, Zi Yan <zi.yan@...t.com>,
akpm@...ux-foundation.org, chandan.babu@...cle.com
Subject: Re: [PATCH v8 01/10] fs: Allow fine-grained control of folio sizes
On Tue, Jul 09, 2024 at 05:38:16PM +0100, Matthew Wilcox wrote:
> On Tue, Jul 09, 2024 at 04:29:07PM +0000, Pankaj Raghav (Samsung) wrote:
> > +++ b/include/linux/pagemap.h
> > @@ -394,13 +394,24 @@ static inline void mapping_set_folio_order_range(struct address_space *mapping,
> > unsigned int min,
> > unsigned int max)
> > {
> > - if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> > + if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
> > + VM_WARN_ONCE(1,
> > + "THP needs to be enabled to support mapping folio order range");
> > return;
> > + }
>
> No. Filesystems call mapping_set_folio_order_range() without it being
> conditional on CONFIG_TRANSPARENT_HUGEPAGE. Usually that takes the
> form of an unconditional call to mapping_set_large_folios().
Ah, you are right.
Actually thinking more about it, we don't need VM_WARN_ONCE on
CONFIG_THP IS_ENABLED, because if we go the route where a FS will
call something like `mapping_max_folio_order_supported()` during mount
time, that will already return `0` as the maximum order that will be
supported.
So just something like this should be enough:
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 14e1415f7dcf..ef6b13854385 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -397,10 +397,18 @@ static inline void mapping_set_folio_order_range(struct address_space *mapping,
if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
return;
- if (min > MAX_PAGECACHE_ORDER)
+ if (min > MAX_PAGECACHE_ORDER) {
+ VM_WARN_ONCE(1,
+ "min order > MAX_PAGECACHE_ORDER. Setting min_order to MAX_PAGECACHE_ORDER");
min = MAX_PAGECACHE_ORDER;
- if (max > MAX_PAGECACHE_ORDER)
+ }
+
+ if (max > MAX_PAGECACHE_ORDER) {
+ VM_WARN_ONCE(1,
+ "max order > MAX_PAGECACHE_ORDER. Setting max_order to MAX_PAGECACHE_ORDER");
max = MAX_PAGECACHE_ORDER;
+ }
+
if (max < min)
max = min;
If we have a helper such as mapping_max_folio_order_supported() that
could be invoked by FSs to see what page cache could support.
And FSs that call mapping_set_large_folios() as an optimization will not
see these random WARNINGS because we call this function with the actual
min and max range.
Let me know what you think.
--
Pankaj
Powered by blists - more mailing lists