[RFC PATCH 4/4] XArray: test: Increase split order test range in check_split()

Ackerley Tng posted 4 patches 2 months, 3 weeks ago
[RFC PATCH 4/4] XArray: test: Increase split order test range in check_split()
Posted by Ackerley Tng 2 months, 3 weeks ago
Expand the range of order values for check_split_1() from 2 *
XA_CHUNK_SHIFT to 4 * XA_CHUNK_SHIFT to test splitting beyond 2 levels.

Separate the loops for check_split_1() and check_split_2() calls, since
xas_try_split() does not yet support splitting beyond 2 levels.

Signed-off-by: Ackerley Tng <ackerleytng@google.com>
---
 lib/test_xarray.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index 42626fb4dc0e..fbdf647e4ef8 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -1905,12 +1905,16 @@ static noinline void check_split(struct xarray *xa)

 	XA_BUG_ON(xa, !xa_empty(xa));

-	for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
+	for (order = 1; order < 4 * XA_CHUNK_SHIFT; order++) {
 		for (new_order = 0; new_order < order; new_order++) {
 			check_split_1(xa, 0, order, new_order);
 			check_split_1(xa, 1UL << order, order, new_order);
 			check_split_1(xa, 3UL << order, order, new_order);
+		}
+	}

+	for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
+		for (new_order = 0; new_order < order; new_order++) {
 			check_split_2(xa, 0, order, new_order);
 			check_split_2(xa, 1UL << order, order, new_order);
 			check_split_2(xa, 3UL << order, order, new_order);
--
2.52.0.rc1.455.g30608eb744-goog
Re: [RFC PATCH 4/4] XArray: test: Increase split order test range in check_split()
Posted by Zi Yan 2 months ago
On 17 Nov 2025, at 17:47, Ackerley Tng wrote:

> Expand the range of order values for check_split_1() from 2 *
> XA_CHUNK_SHIFT to 4 * XA_CHUNK_SHIFT to test splitting beyond 2 levels.
>
> Separate the loops for check_split_1() and check_split_2() calls, since
> xas_try_split() does not yet support splitting beyond 2 levels.

xas_try_split() is designed to only split at most 1 level. It is used
for non-uniform split, which always splits a folio from order N to order N-1.

>
> Signed-off-by: Ackerley Tng <ackerleytng@google.com>
> ---
>  lib/test_xarray.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/lib/test_xarray.c b/lib/test_xarray.c
> index 42626fb4dc0e..fbdf647e4ef8 100644
> --- a/lib/test_xarray.c
> +++ b/lib/test_xarray.c
> @@ -1905,12 +1905,16 @@ static noinline void check_split(struct xarray *xa)
>
>  	XA_BUG_ON(xa, !xa_empty(xa));
>
> -	for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
> +	for (order = 1; order < 4 * XA_CHUNK_SHIFT; order++) {
>  		for (new_order = 0; new_order < order; new_order++) {
>  			check_split_1(xa, 0, order, new_order);
>  			check_split_1(xa, 1UL << order, order, new_order);
>  			check_split_1(xa, 3UL << order, order, new_order);
> +		}
> +	}
>
> +	for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
> +		for (new_order = 0; new_order < order; new_order++) {
>  			check_split_2(xa, 0, order, new_order);
>  			check_split_2(xa, 1UL << order, order, new_order);
>  			check_split_2(xa, 3UL << order, order, new_order);
> --
> 2.52.0.rc1.455.g30608eb744-goog


--
Best Regards,
Yan, Zi
Re: [RFC PATCH 4/4] XArray: test: Increase split order test range in check_split()
Posted by Ackerley Tng 2 months ago
Zi Yan <ziy@nvidia.com> writes:

> On 17 Nov 2025, at 17:47, Ackerley Tng wrote:
>
>> Expand the range of order values for check_split_1() from 2 *
>> XA_CHUNK_SHIFT to 4 * XA_CHUNK_SHIFT to test splitting beyond 2 levels.
>>
>> Separate the loops for check_split_1() and check_split_2() calls, since
>> xas_try_split() does not yet support splitting beyond 2 levels.
>
> xas_try_split() is designed to only split at most 1 level. It is used
> for non-uniform split, which always splits a folio from order N to order N-1.
>

Thanks for explaining! In the next revision, I'll rename

  + check_split_1() to check_split_uniform() and
  + check_split_2() to check_split_non_uniform()

in an earlier patch before, fixing the wording, in this patch, to be

  Separate the loops for check_split_uniform() and
  check_split_non_uniform() calls. Expanding the range of order values
  only applies for uniform splits, since non-uniform splits always split
  a folio from order N to order N-1.

>>
>> Signed-off-by: Ackerley Tng <ackerleytng@google.com>
>> ---
>>  lib/test_xarray.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/test_xarray.c b/lib/test_xarray.c
>> index 42626fb4dc0e..fbdf647e4ef8 100644
>> --- a/lib/test_xarray.c
>> +++ b/lib/test_xarray.c
>> @@ -1905,12 +1905,16 @@ static noinline void check_split(struct xarray *xa)
>>
>>  	XA_BUG_ON(xa, !xa_empty(xa));
>>
>> -	for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
>> +	for (order = 1; order < 4 * XA_CHUNK_SHIFT; order++) {
>>  		for (new_order = 0; new_order < order; new_order++) {
>>  			check_split_1(xa, 0, order, new_order);
>>  			check_split_1(xa, 1UL << order, order, new_order);
>>  			check_split_1(xa, 3UL << order, order, new_order);
>> +		}
>> +	}
>>
>> +	for (order = 1; order < 2 * XA_CHUNK_SHIFT; order++) {
>> +		for (new_order = 0; new_order < order; new_order++) {
>>  			check_split_2(xa, 0, order, new_order);
>>  			check_split_2(xa, 1UL << order, order, new_order);
>>  			check_split_2(xa, 3UL << order, order, new_order);
>> --
>> 2.52.0.rc1.455.g30608eb744-goog
>
>
> --
> Best Regards,
> Yan, Zi