lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240717094621.fdobfk7coyirg5e5@quentin>
Date: Wed, 17 Jul 2024 09:46:21 +0000
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: david@...morbit.com, chandan.babu@...cle.com, djwong@...nel.org,
	brauner@...nel.org, akpm@...ux-foundation.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, ryan.roberts@....com, hch@....de,
	Zi Yan <ziy@...dia.com>
Subject: Re: [PATCH v10 01/10] fs: Allow fine-grained control of folio sizes

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.

That makes sense. I will move it to the last patch.

> 
> > +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.

Hmm, but you raised the point about clamping in the previous patches[1]
after Ryan pointed out that we should not silently clamp the order.

```
> It seems strange to silently clamp these? Presumably for the bs>ps usecase,
> whatever values are passed in are a hard requirement? So wouldn't want them to
> be silently reduced. (Especially given the recent change to reduce the size of
> MAX_PAGECACHE_ORDER to less then PMD size in some cases).

Hm, yes.  We should probably make this return an errno.  Including
returning an errno for !IS_ENABLED() and min > 0.
```

It was not clear from the conversation in the previous patches that we
decided to just clamp the order (like it was done before).

So let's just stick with how it was done before where we clamp the
values if min and max > MAX_PAGECACHE_ORDER?

[1] https://lore.kernel.org/linux-fsdevel/Zoa9rQbEUam467-q@casper.infradead.org/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ