From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 017DC2DCC08 for ; Mon, 9 Feb 2026 19:16:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770664617; cv=none; b=lPAyvMfTKHay+cYr8vtViPadgWnPJ56Lmx1uAcrLXNJc0cLTpwUT1S/RjPaAm3htLct6izSOTCHiRuapsyKi5wKSgo3ANjhc+4FEjd0H6unvrhoFIFa+d16F1YILNLBCSmULnYheQ+SxvAVFRSXFwaHd9R8484n75Ut/KdexxKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770664617; c=relaxed/simple; bh=Y/ATvj9EL3uMV7cAC+NHqra7mdo2DGKjs4juhNkrkeM=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=QhXuM81lxD7LMVJPRrBU7wR97iYufK2Ge7fVmVlz7/TpFcC19jS3D2NKV+XQPverr7wlPUp29jNGwU78o8isoKkrpMoe5bz/J6vT74T3XxWjtbXbVFg82KKQ/gbUtx7z8+/evdjUKoMLuXroGmkeqV4ycC0x6IJK0oxbCAfhezU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ackerleytng.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=4ccjb8ky; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ackerleytng.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="4ccjb8ky" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c5269fcecdeso1997446a12.0 for ; Mon, 09 Feb 2026 11:16:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770664616; x=1771269416; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=gltt6Xe6DQ/hUW9baNp0LT+ih0woRx1cYGTgZsKwvqs=; b=4ccjb8kyEt9T4BA4+EcCgeTQO6el9ShKhAdQS9xdYB8zcIvboQMieuA8JSwU83QeKZ lU69gH2BEHYKEp//nAgUbyJEn3R+hG+HjFm6TNYBJggCElpIKMPY1kk1hWYCeF6BxVvl C3DBBn0hPgOEzXSPk2HrWocG+fGu4AgSMuXS4OsoPElLfC50PDmsIDZ8x1P6FkV5oo4X kRrtX/hflThMt2nI/eWO/+oXkGyURZiBDPthug2azcDkyQoPcBL+PuZgNbvFxUZhc7HU J0GVg87OP1+Qk9iSrZ0GFgRqGiBcXol8jOXqQD5/HlRiDT6+9yguB3iUifaAmYXT/V/N zbDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770664616; x=1771269416; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gltt6Xe6DQ/hUW9baNp0LT+ih0woRx1cYGTgZsKwvqs=; b=Cz/IslcxyO3pXfkRm8ZoizA+yxjl9KGNYr3GbImMkqzUhDUi/fouvKEGt6j+2Q/kHY oDgfY4Biw1BAqDMRFYNYhS/mfT7QRsYcZQ6EefNOzT2cDXaREuK+uTUlSVy/P0qSq4Og uuzQHTPpKxpWb5LqxZilFII/mMm5Wr8GJ1INA3L1qyV+qiSWJWX//qMkttBPhIYQAMWz l14mvZmPg5cwey2vDASa2wdvudOpskVVWQbEcvzmapuPi6kC5bRVBAP/IeY1bopxXSC8 KBNkY0dMVDAL7I8klBkYljry/QaVmveK7Ls3aeaoRRRaXJXIRwTTFsNtz9zaqv+rNewY EuiQ== X-Forwarded-Encrypted: i=1; AJvYcCW3rMgCKKOqQ1wGZFvRSwnqpWtd9uGpVNtV7yp8L/nZuK8Txrb54n8bj884KWLmTPdJ1xB7IOWXX9DLoNY=@vger.kernel.org X-Gm-Message-State: AOJu0YwUkslxQlRtU1DXdrPq1k8v7FUDkQkd1R186irxyPLTPKkEwOJa R3cMO/1SH8YJzpLqSOHvjgb/f3If7V4zfp2ASyKm7ZDgWTQgXxcxeGlIE+yeLdSlZAvYsqTpCWy g2lUSkNy4w9NUdDlrqn0II3SxAQ== X-Received: from plbjy6.prod.google.com ([2002:a17:903:42c6:b0:2a9:628c:cd39]) (user=ackerleytng job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f54e:b0:2a4:8cd:c3cf with SMTP id d9443c01a7336-2a951926c4dmr98825655ad.49.1770664616237; Mon, 09 Feb 2026 11:16:56 -0800 (PST) Date: Mon, 9 Feb 2026 11:16:42 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.rc2.204.g2597b5adb4-goog Message-ID: Subject: [RFC PATCH v1 0/2] Fix storing in XArray check_split tests From: Ackerley Tng To: willy@infradead.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: david@redhat.com, michael.roth@amd.com, dev.jain@arm.com, vannapurve@google.com, Ackerley Tng Content-Type: text/plain; charset="UTF-8" Hi, (resending to fix Message-ID, also gently nudging for feedback!) I hit an assertion while making some modifications to lib/test_xarray.c [1] and I believe this is the fix. In check_split, the tests split the XArray node and then store values after the split to verify that splitting worked. While storing and retrieval works as expected, the node's metadata, specifically node->nr_values, is not updated correctly. This led to the assertion being hit in [1], since the storing process did not increment node->nr_values sufficiently, while the erasing process assumed the fully-incremented node->nr_values state. Would like to check my understanding on these: 1. In the multi-index xarray world, is node->nr_values definitely the total number of values *and siblings* in the node? 2. IIUC xas_store() has significantly different behavior when entry is NULL vs non-NULL: when entry is NULL, xas_store() does not make assumptions on the number of siblings and erases all the way till the next non-sibling entry. This sounds fair to me, but it's also kind of surprising that it is differently handled when entry is non-NULL, where xas_store() respects xas->xa_sibs. 3. If xas_store() is dependent on its caller to set up xas correctly (also sounds fair), then there are places where xas_store() is used, like replace_page_cache_folio() or migrate_huge_page_move_mapping(), where xas is set up assuming 0 order pages. Are those buggy? [1] https://lore.kernel.org/all/20251028223414.299268-1-ackerleytng@google.com/ Ackerley Tng (2): XArray tests: Fix check_split tests to store correctly XArray tests: Verify xa_erase behavior in check_split lib/test_xarray.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) -- 2.53.0.rc1.225.gd81095ad13-goog