From: Matthew Wilcox <willy@infradead.org>
To: David Hildenbrand <david@redhat.com>
Cc: Gavin Shan <gshan@redhat.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
Zhenyu Zhang <zhenyzha@redhat.com>,
Linux XFS <linux-xfs@vger.kernel.org>,
Linux Filesystems Development <linux-fsdevel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Shaoqin Huang <shahuang@redhat.com>,
Chandan Babu R <chandan.babu@oracle.com>,
"Darrick J. Wong" <djwong@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Endless calls to xas_split_alloc() due to corrupted xarray entry
Date: Wed, 19 Jun 2024 15:31:07 +0100 [thread overview]
Message-ID: <ZnLrq4vJnfSNZ0wg@casper.infradead.org> (raw)
In-Reply-To: <6d3687fd-e11b-4d78-9944-536bb1d731de@redhat.com>
On Wed, Jun 19, 2024 at 11:45:22AM +0200, David Hildenbrand wrote:
> I recall talking to Willy at some point about the problem of order-13 not
> being fully supported by the pagecache right now (IIRC primiarly splitting,
> which should not happen for hugetlb, which is why there it is not a
> problem). And I think we discussed just blocking that for now.
>
> So we are trying to split an order-13 entry, because we ended up
> allcoating+mapping an order-13 folio previously.
>
> That's where things got wrong, with the current limitations, maybe?
>
> #define MAX_PAGECACHE_ORDER HPAGE_PMD_ORDER
>
> Which would translate to MAX_PAGECACHE_ORDER=13 on aarch64 with 64k.
>
> Staring at xas_split_alloc:
>
> WARN_ON(xas->xa_shift + 2 * XA_CHUNK_SHIFT < order)
>
> I suspect we don't really support THP on systems with CONFIG_BASE_SMALL.
> So we can assume XA_CHUNK_SHIFT == 6.
>
> I guess that the maximum order we support for splitting is 12? I got confused
> trying to figure that out. ;)
Actually, it's 11. We can't split an order-12 folio because we'd have
to allocate two levels of radix tree, and I decided that was too much
work. Also, I didn't know that ARM used order-13 PMD size at the time.
I think this is the best fix (modulo s/12/11/). Zi Yan and I discussed
improving split_folio() so that it doesn't need to split the entire
folio to order-N. But that's for the future, and this is the right fix
for now.
For the interested, when we say "I need to split", usually, we mean "I
need to split _this_ part of the folio to order-N", and we're quite
happy to leave the rest of the folio as intact as possible. If we do
that, then splitting from order-13 to order-0 becomes quite a tractable
task, since we only need to allocate 2 radix tree nodes, not 65.
/**
* folio_split - Split a smaller folio out of a larger folio.
* @folio: The containing folio.
* @page_nr: The page offset within the folio.
* @order: The order of the folio to return.
*
* Splits a folio of order @order from the containing folio.
* Will contain the page specified by @page_nr, but that page
* may not be the first page in the returned folio.
*
* Context: Caller must hold a reference on @folio and has the folio
* locked. The returned folio will be locked and have an elevated
* refcount; all other folios created by splitting the containing
* folio will be unlocked and not have an elevated refcount.
*/
struct folio *folio_split(struct folio *folio, unsigned long page_nr,
unsiged int order);
> I think this does not apply to hugetlb because we never end up splitting
> entries. But could this also apply to shmem + PMD THP?
Urgh, good point. We need to make that fail on arm64 with 64KB page
size. Fortunately, it almost always failed anyway; it's really hard to
allocate 512MB pages.
next prev parent reply other threads:[~2024-06-19 14:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAJFLiB+J4mKGDOppp=1moMe2aNqeJhM9F2cD4KPTXoM6nzb5RA@mail.gmail.com>
[not found] ` <ZRFbIJH47RkQuDid@debian.me>
2023-09-25 15:12 ` Darrick J. Wong
2023-09-26 7:49 ` Zhenyu Zhang
2023-09-29 10:11 ` Gavin Shan
2023-09-29 19:17 ` Matthew Wilcox
2023-09-30 2:12 ` Gavin Shan
2024-06-19 9:45 ` David Hildenbrand
2024-06-19 14:31 ` Matthew Wilcox [this message]
2024-06-19 15:48 ` Linus Torvalds
2024-06-19 19:58 ` David Hildenbrand
2024-06-25 1:10 ` Gavin Shan
2024-06-19 20:50 ` Matthew Wilcox
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=ZnLrq4vJnfSNZ0wg@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bagasdotme@gmail.com \
--cc=chandan.babu@oracle.com \
--cc=david@redhat.com \
--cc=djwong@kernel.org \
--cc=gshan@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=shahuang@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=zhenyzha@redhat.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
all inboxes | Powered by JetHome®