Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Dynamically allocated kernel memory leaks if a KUnit assertion fails during block allocation. --
commit b7e7a71f5be8a7ec99f348cd4b1b9f77122e136f 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 benefits of the decoupled dirty-tracker design over the old approach. The test runs two scenarios on a 4 GiB pool with alternating fragmentation and measures block allocation throughput. > diff --git a/drivers/gpu/tests/gpu_buddy_test.c > b/drivers/gpu/tests/gpu_buddy_test.c > index 6ce485eae83ee..b75d32ca6ca0a 100644 > --- a/drivers/gpu/tests/gpu_buddy_test.c > +++ b/drivers/gpu/tests/gpu_buddy_test.c [ ... ] > @@ -283,6 +283,121 @@ static void > gpu_test_buddy_fragmentation_performance(struct kunit *test) [ ... ] > + KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_init(&mm, SZ_4G, SZ_4K), > + "buddy_init failed\n"); > + > + for (i = 0; i < SZ_4G / SZ_4K; i++) > + KUNIT_ASSERT_FALSE_MSG(test, > + gpu_buddy_alloc_blocks(&mm, 0, SZ_4G, > SZ_4K, SZ_4K, > + &allocated, 0), > + "buddy_alloc hit an error size=%u\n", > SZ_4K); [Severity: Medium] Could this leak dynamically allocated kernel memory if the test assertion fails during block allocation? The test performs 1,048,576 allocations in this loop. If any of these fail (for instance, due to system memory pressure), KUNIT_ASSERT_FALSE_MSG triggers and immediately aborts execution. Because there are no deferred cleanup handlers registered, all previously allocated buddy blocks in the local lists and internal structures allocated by gpu_buddy_init() are permanently leaked. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2
