From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE5F5606A327 for ; Sun, 29 Nov 2026 03:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=2uEU/xdX Received: by kanga.kvack.org (Postfix) id 6397E6B05B0; Sat, 28 Nov 2026 22:12:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EAC06B05B1; Sat, 28 Nov 2026 22:12:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FFC66B05B2; Sat, 28 Nov 2026 22:12:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1B22B6B05B0 for ; Sat, 28 Nov 2026 22:12:09 -0500 (EST) Received: from smtpin19.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7E98E1C4167 for ; Sun, 29 Nov 2026 03:12:06 +0000 (UTC) X-FDA: 85486682652.19.753F3E1 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf14.hostedemail.com (Postfix) with ESMTP id B6FBE100002 for ; Sun, 29 Nov 2026 03:12:04 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="2uEU/xdX"; dmarc=none; spf=pass (imf14.hostedemail.com: domain of akpm@linux-foundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1795921924; b=8KS9QVNd7HgQplAXJzMg8jN1q8BKkIlDcNCy+YOhzcQVT0P4anC+Dc+8hxzV4xINKDIDMi Yo82tg8PRpnGSaqW4HWZ9VdlBylkPf5zhtbClmB/Zx9Ty8VIzumjRqYDwyeskbljds3tpj n5ru/1WETKsE6u3It/pzhPgWH1Per94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1795921924; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=S7NOj3uHHLubNV+5muJuPf5YFGLLHf+PEA8TQoSMtuw=; b=7JDPYWAj7xvzJvk39U/rFUiFlsuJet9cy1eayD2YjXYujHnXEXbUnHonk5onjr2n7m/QyA xClBnw0mgSlLTT3vbYmo4My2NjZ3OCFQQhpSqPwQ43qFr3OBPYCMjogKO1lLPYOvl1HZt9 kCsctXzD7HUmkViQaZNIDmFt+3a+usc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="2uEU/xdX"; dmarc=none; spf=pass (imf14.hostedemail.com: domain of akpm@linux-foundation.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D868941479; Sun, 29 Nov 2026 03:12:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B17D1F000C1; Sun, 29 Nov 2026 03:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1795921923; bh=S7NOj3uHHLubNV+5muJuPf5YFGLLHf+PEA8TQoSMtuw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=2uEU/xdXjiJ0hAA2YRrHkDpq0yIgs5siKuaxxOaQq0eglWHidgsFbfk69Gt/YpvIO /5qPgg+U7ZFedEuqpkPwmaYKqKH3xUk1wgETlnzsuTTsH0gbuGKiiIin5qrNf4NWH7 e6eNdUrWmdr+KaRlaj6v0GIUv/bZTital1VOgaxQ= Date: Sat, 28 Nov 2026 19:12:03 -0800 From: Andrew Morton To: Qian Xiao Cc: Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Krystian Kaniewski Subject: Re: [PATCH v3] xarray: fix index jumping backwards in xas_find_marked() Message-Id: <20261128191203.6d8a42b8a55809048367f903@linux-foundation.org> In-Reply-To: <20261127222110.3755894-1-heyheyco@gmail.com> References: <20261126190847.3064508-1-heyheyco@gmail.com> <20261127222110.3755894-1-heyheyco@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Archived-By: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B6FBE100002 X-Stat-Signature: ephqemsboiybe9u4drcbo5y8aon9k7xb X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Rspam-User: X-HE-Tag: 1795921924-70483 X-HE-Meta: U2FsdGVkX19vVjwXkefeLaleP+xF6pgTMsTiyGEy3SYELQo4q69X+H3fPeGTcBytXI03T5l5/KyBtYvw8koTUhUap0WKyZp6M+wTN7s/FdUaxuLmuJ8UWSVF+eoz59BG97E3GaYNHajttj0vFf8WtEmwOkz6/XsyNcKKaBMlfglxfJEUq6JPsRQn6CO5Z5hiazskVBqloV15+c5jXVUmLT37zi7ZilOmPKNf4ydjXvbyqQiHiKbvVMgmIn+g5jnZNKH3MOgV5oidVE3I1fIbUoVWfJojwn7Ul0ukhVwossNrYvihn5FKbAeFgQLHw6/Gi9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Tc9xBd3JUMnW2SRKCLC3j1vO6hGCxokvsz92ILKmAGmVKruTL91BPQqjF/BpVant15G2pbQBOd/LZ6KVB79ljPnrsl6AVHI5sEaY5bQZjiep4DLif1n6uxn+5k= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Fri, 27 Nov 2026 14:21:09 -0800 Qian Xiao 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 :(