Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Scenario 1 of the dirty tracker performance test fails to exercise 
the contiguous allocation path and `__force_merge()`, rendering its benchmark 
results invalid.
--

--- Patch [2]: [PATCH v10 2/2] gpu/tests/buddy: add dirty tracker performance 
KUnit test ---
commit 31fa603bd9e94c9fc78fd665cdb47f320c0dabdd
Author: Arunpravin Paneer Selvam <[email protected]>

gpu/tests/buddy: add dirty tracker performance KUnit test

This commit adds a new KUnit test to demonstrate the performance advantage
of the decoupled dirty-tracker design over the previous dual-tree and
force_merge approach.

> diff --git a/drivers/gpu/tests/gpu_buddy_test.c 
> b/drivers/gpu/tests/gpu_buddy_test.c
> index 6ce485eae83ee..04344468ab6bf 100644
> --- a/drivers/gpu/tests/gpu_buddy_test.c
> +++ b/drivers/gpu/tests/gpu_buddy_test.c
[ ... ]
> +static void gpu_test_buddy_dirty_tracker_performance(struct kunit *test)
> +{
[ ... ]
> +     start = ktime_get();
> +     KUNIT_ASSERT_FALSE_MSG(test,
> +                            gpu_buddy_alloc_blocks(&mm, 0, SZ_4G, SZ_4G, 
> SZ_4K,
> +                                                   &results,
> +                                                   
> GPU_BUDDY_CONTIGUOUS_ALLOCATION),
> +                            "contiguous alloc failed\n");

[Severity: Medium]
Does this allocation actually exercise the contiguous allocation path and
invoke __force_merge() as intended?

Looking at gpu_buddy_alloc_blocks(), when start + size == end (0 + SZ_4G ==
SZ_4G), the function takes an early exact-range allocation path and returns
__gpu_buddy_alloc_range():

drivers/gpu/buddy.c:gpu_buddy_alloc_blocks() {
    ...
        /* Actual range allocation */
        if (start + size == end) {
                if (!IS_ALIGNED(start | end, min_block_size))
                        return -EINVAL;

                return __gpu_buddy_alloc_range(mm, start, size, flags, NULL, 
blocks);
        }
    ...
}

This bypasses the contiguous allocation logic entirely, meaning the baseline
measurement of 71 ms might just be the overhead of iterating the tree and
gathering 1,048,576 individual 4 KiB fragments into a list, rather than
measuring __force_merge() performance.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to