Re: [PATCH v10 01/10] fs: Allow fine-grained control of folio sizes

From: Pankaj Raghav (Samsung)
Date: Mon Jul 22 2024 - 10:20:34 EST


@willy:

I want to clarify before sending the next round of patches as I didn't
get any reply in the previous email.

IIUC your comments properly:

- I will go back to silent clamping in mapping_set_folio_order_range as
before and remove VM_WARN_ONCE().

- I will move the mapping_max_folio_size_supported() to patch 10, and FSs
can use them to check for the max block size that can be supported and
take the respective action.

--
Pankaj

On Tue, Jul 16, 2024 at 04:26:10PM +0100, Matthew Wilcox wrote:
> On Mon, Jul 15, 2024 at 11:44:48AM +0200, Pankaj Raghav (Samsung) wrote:
> > +/*
> > + * mapping_max_folio_size_supported() - Check the max folio size supported
> > + *
> > + * The filesystem should call this function at mount time if there is a
> > + * requirement on the folio mapping size in the page cache.
> > + */
> > +static inline size_t mapping_max_folio_size_supported(void)
> > +{
> > + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> > + return 1U << (PAGE_SHIFT + MAX_PAGECACHE_ORDER);
> > + return PAGE_SIZE;
> > +}
>
> There's no need for this to be part of this patch. I've removed stuff
> from this patch before that's not needed, please stop adding unnecessary
> functions. This would logically be part of patch 10.
>
> > +static inline void mapping_set_folio_order_range(struct address_space *mapping,
> > + unsigned int min,
> > + unsigned int max)
> > +{
> > + if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> > + return;
> > +
> > + 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;
> > + }
>
> This is really too much. It's something that will never happen. Just
> delete the message.
>
> > + 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;
>
> Absolutely not. If the filesystem declares it can support a block size
> of 4TB, then good for it. We just silently clamp it.
>