From: Krystian Kaniewski <krystianmkaniewski@gmail.com>
To: "Jose Fernandez (Anthropic)" <jose.fernandez@linux.dev>,
Pedro Falcato <pfalcato@suse.de>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] mm/filemap: stop fault-around when the walk steps back
Date: Fri, 6 Nov 2026 12:36:05 +0100 [thread overview]
Message-ID: <4284c2d3-75cb-4e41-aa45-f7311e60ab4a@gmail.com> (raw)
In-Reply-To: <au0GBdGqu6cv5PMy@linux.dev>
On 11/5/26 23:43, Jose Fernandez (Anthropic) wrote:
> On Thu, 5 Nov 2026 12:19:13 +0000, Pedro Falcato wrote:
>> Thank you. So, if I'm not mistaken, this is the race:
>> First, you map/see this:
>> [folio pgoff 4, length 4]
>> Then, at some point in time, someone punches the hole:
>> [no folios here]
>> Then, at some point in time, someone faults another folio in the range:
>> [folio pgoff 0, length 8]
>> so you step backwards. Is this correct? Or am I misunderstanding this?
>
> Not quite. In my test a large folio goes away and a small one comes back
> below where the walk started. If that happens during the walk's first
> lookup, the walk can step back. Krystian's fix doesn't cover that
> lookup.
>
Right. My patch only covers the case where the walk has already
returned an entry. The first lookup, and every lookup after xas_retry(),
starts in the XAS_RESTART branch. My patch does not change that branch.
There, xas_load() can read the sibling slot of the start index before
a concurrent erase, and the canonical slot after it. In that case it
returns NULL, but xa_offset still points to the canonical slot.
xas_find() then moves on to the slot after the canonical slot. That
slot can be below the start index.
I tested this in the userspace XArray harness. I wrote that state into
a node and called xas_find() from XAS_RESTART. It returned an index
below the start, with and without my patch.
Andrew, Jose's Tested-by for the xarray patch is on the filemap patch
in mm-hotfixes-unstable.
--
Krystian Kaniewski
next prev parent reply other threads:[~2026-11-06 11:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 4:33 Jose Fernandez (Anthropic)
2026-11-02 17:27 ` Andrew Morton
2026-11-05 22:13 ` Jose Fernandez
2026-11-05 22:24 ` Jose Fernandez (Anthropic)
2026-11-02 21:47 ` Jan Kara
2026-11-03 12:12 ` Pedro Falcato
2026-11-04 23:12 ` Jose Fernandez (Anthropic)
2026-11-05 12:19 ` Pedro Falcato
2026-11-05 22:43 ` Jose Fernandez (Anthropic)
2026-11-06 11:36 ` Krystian Kaniewski [this message]
2026-11-06 15:57 ` Andrew Morton
2026-11-05 10:07 ` David Hildenbrand (Arm)
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=4284c2d3-75cb-4e41-aa45-f7311e60ab4a@gmail.com \
--to=krystianmkaniewski@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jose.fernandez@linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pfalcato@suse.de \
--cc=stable@vger.kernel.org \
--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 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®