All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>
Subject: Re: Issue with 8K folio size in __filemap_get_folio()
Date: Mon, 4 Dec 2023 08:16:42 +1100	[thread overview]
Message-ID: <ZWzwOmFoGPrtKb8v@dread.disaster.area> (raw)
In-Reply-To: <B467D07C-00D2-47C6-A034-2D88FE88A092@dubeyko.com>

On Sun, Dec 03, 2023 at 11:11:14PM +0300, Viacheslav Dubeyko wrote:
> Hi Matthew,
> 
> I believe we have issue in __filemap_get_folio() logic for the case of 8K folio size (order is equal to 1).
> 
> Let’s imagine we have such code and folio is not created yet for index == 0:
> 
> fgf_t fgp_flags = FGP_WRITEBEGIN;
> 
> mapping_set_large_folios(mapping);
> fgp_flags |= fgf_set_order(8192);
> 
> folio = __filemap_get_folio(mapping, 0, fgf_flags, mapping_gfp_mask(mapping));
> 
> As a result, we received folio with size 4K but not 8K as it was expected:

Getting a 4kB folio back in this case is expected behaviour.

> So, why do we correct the order to zero always if order is equal to one?
> It sounds for me like incorrect logic. Even if we consider the troubles
> with memory allocation, then we will try allocate, for example, 16K, exclude 8K,
> and, finally, will try to allocate 4K. This logic puzzles me anyway.
> Do I miss something here?

That a high-order folio requires 3 struct page headers to hold all
the internal state, and there are only two struct page headers
available for an 8kB folio.

Hence order-1 folios don't exist...

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2023-12-03 21:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 20:11 Issue with 8K folio size in __filemap_get_folio() Viacheslav Dubeyko
2023-12-03 21:16 ` Dave Chinner [this message]
2023-12-03 21:27 ` Matthew Wilcox
2023-12-03 23:12   ` Matthew Wilcox
2023-12-04  5:57     ` Hugh Dickins
2023-12-04 15:09     ` David Hildenbrand
2023-12-04 16:51       ` David Hildenbrand
2023-12-04 17:17       ` Matthew Wilcox
2023-12-04 17:22         ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWzwOmFoGPrtKb8v@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.