All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v1 0/2] Fix storing in XArray check_split tests
@ 2026-02-09 19:16 Ackerley Tng
  2026-01-31  0:15 ` [RFC PATCH v1 1/2] XArray tests: Fix check_split tests to store correctly Ackerley Tng
  2026-01-31  0:15 ` [RFC PATCH v1 2/2] XArray tests: Verify xa_erase behavior in check_split Ackerley Tng
  0 siblings, 2 replies; 4+ messages in thread
From: Ackerley Tng @ 2026-02-09 19:16 UTC (permalink / raw)
  To: willy, akpm, linux-fsdevel, linux-mm, linux-kernel
  Cc: david, michael.roth, dev.jain, vannapurve, Ackerley Tng

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

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [RFC PATCH v1 0/2] Fix storing in XArray check_split tests
@ 2026-01-31  0:15 Ackerley Tng
  0 siblings, 0 replies; 4+ messages in thread
From: Ackerley Tng @ 2026-01-31  0:15 UTC (permalink / raw)
  To: willy, akpm, linux-fsdevel, linux-mm, linux-kernel
  Cc: david, michael.roth, dev.jain, vannapurve, Ackerley Tng

Hi,

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-09 19:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 19:16 [RFC PATCH v1 0/2] Fix storing in XArray check_split tests Ackerley Tng
2026-01-31  0:15 ` [RFC PATCH v1 1/2] XArray tests: Fix check_split tests to store correctly Ackerley Tng
2026-01-31  0:15 ` [RFC PATCH v1 2/2] XArray tests: Verify xa_erase behavior in check_split Ackerley Tng
  -- strict thread matches above, loose matches on Subject: below --
2026-01-31  0:15 [RFC PATCH v1 0/2] Fix storing in XArray check_split tests Ackerley Tng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.