mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Qian Xiao <heyheyco@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Krystian Kaniewski <krystianmkaniewski@gmail.com>
Subject: Re: [PATCH v3] xarray: fix index jumping backwards in xas_find_marked()
Date: Sat, 28 Nov 2026 19:12:03 -0800	[thread overview]
Message-ID: <20261128191203.6d8a42b8a55809048367f903@linux-foundation.org> (raw)
In-Reply-To: <20261127222110.3755894-1-heyheyco@gmail.com>

On Fri, 27 Nov 2026 14:21:09 -0800 Qian Xiao <heyheyco@gmail.com> wrote:

> xas_find() keeps xa_index when a lookup starts inside a multi-index
> entry stored in a non-leaf node, and aligns xa_offset with that index
> before advancing. xas_find_marked() still does neither.
> 
> Walking from a sibling slot to the canonical slot calls
> xas_move_index(), so a start index such as 127 becomes 0. After the
> cursor has been walked, xa_offset can also stay on the canonical slot
> while xa_index is inside a later slot of the same entry. The next
> xas_find_marked() then recomputes xa_index from the stale offset. If
> the entry is split, the call returns a marked entry below the index
> already reached. xas_find() returns the following entry in the same
> situation.
> 
> Resolve the sibling without moving xa_index. Before advancing a cursor
> that has already been walked, set xa_offset from xa_index the same way
> xas_find() does. xas_next_marked() uses that path when the offset and
> index disagree, as xas_next_entry() already does. xas_pause() aligns
> xa_offset before its existing calculation, so the resume index stays at
> the end of the entry.
> 
> If the tree changes while a sibling is being resolved, do not descend
> into a node that does not contain xa_index, and do not move xa_index
> backwards. Compare the next marked slot with get_offset() instead of
> recomputing xa_index with a 32-bit shift. Return XA_RETRY_ENTRY.
> xa_find_after() handles that retry before xas_sibling(), so a rewind
> that then retries restarts the walk. Callers that use xas_retry()
> restart from the same index.

What is the relationship between this and Krystian's identically-named
patch? 
https://lore.kernel.org/20260904121301.200049-1-krystianmkaniewski@gmail.com

> The userspace XArray test suite passed.

> The kernel was not built.

Well that isn't encouraging :(



      reply	other threads:[~2026-11-29  3:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 21:34 [PATCH] " Qian Xiao
2026-11-26 19:08 ` [PATCH v2] " Qian Xiao
2026-11-27 22:21   ` [PATCH v3] " Qian Xiao
2026-11-29  3:12     ` Andrew Morton [this message]

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=20261128191203.6d8a42b8a55809048367f903@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=heyheyco@gmail.com \
    --cc=krystianmkaniewski@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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®