linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: Linux FS Devel <linux-fsdevel@vger.kernel.org>, linux-mm@kvack.org
Subject: Re: Issue with 8K folio size in __filemap_get_folio()
Date: Sun, 3 Dec 2023 21:27:57 +0000	[thread overview]
Message-ID: <ZWzy3bLEmbaMr//d@casper.infradead.org> (raw)
In-Reply-To: <B467D07C-00D2-47C6-A034-2D88FE88A092@dubeyko.com>

On Sun, Dec 03, 2023 at 11:11:14PM +0300, Viacheslav Dubeyko wrote:
> 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?

The problem I'm trying to avoid is that when we allocate an order-1
folio, we only have two struct pages for the folio.  At the moment, we
have the deferred_list stored in the third struct page of the folio.
There isn't quite space to squeeze it into the second struct page on
32-bit systems -- we have

_flags_1		flags
_head_1			lru.head
_folio_avail		lru.tail
_entire_mapcount	mapping
_nr_pages_mapped	index
_pincount		private

after that we'd start to collide with _mapcount (which is still used
per-page) and _refcount (which must be 0 on tail pages).  We have one
word available (_folio_avail), but we'd need two to fit in a list_head.

We might be able to reengineer things so that we don't need a list_head
for deferred_list.  eg we could store deferred-split folios in an
xarray and only store the index in the folio.  Or we could decline to
deferred-split folios that are order-1.  I haven't looked into it in
detail, but I feel like this might be an acceptable approach.

I was talking with Darrick on Friday and he convinced me that this is
something we're going to need to fix sooner rather than later for the
benefit of devices with block size 8kB.  So it's definitely on my todo
list, but I haven't investigated in any detail yet.

Thanks for raising the issue; it gave me a good opportunity to explain
my current thinking on the problem.  Adding linux-mm for insights from
the MM audience.


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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <B467D07C-00D2-47C6-A034-2D88FE88A092@dubeyko.com>
2023-12-03 21:27 ` Matthew Wilcox [this message]
2023-12-03 23:12   ` Issue with 8K folio size in __filemap_get_folio() 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=ZWzy3bLEmbaMr//d@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=slava@dubeyko.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).