]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/buddy: Add KUnit tests for allocator performance under fragmentation
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Mon, 6 Oct 2025 09:51:24 +0000 (15:21 +0530)
committerArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Tue, 7 Oct 2025 13:49:15 +0000 (19:19 +0530)
commitc07823f85012b80d8b2e251acbc23a0bdc2925c2
tree3297b03c24144ce56e37b2fd6cd3ecd80c270599
parentd4cd665c98c144dd6ad5d66d30396e13d23118c9
drm/buddy: Add KUnit tests for allocator performance under fragmentation

Add KUnit test cases that create severe memory fragmentation and
measure allocation/free performance.

The tests simulate two scenarios -

1. Allocation under severe fragmentation
   - Allocate the entire 4 GiB space as 8 KiB blocks with 64 KiB alignment,
     split them into two groups and free with mixed flags to block coalescing.
   - Repeatedly allocate and free 64 KiB blocks while timing the loop.
   - Freelist runtime: 76475 ms(76.5 seconds), soft-lockup triggered.
     RB-tree runtime: 186 ms.

2. Reverse free order under fragmentation
   - Create a similarly fragmented space, free half the blocks, reverse
     the order of the remainder, and release them with the cleared flag.
   - Freelist runtime: 85620 ms(85.6 seconds).
     RB-tree runtime: 114 ms.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://lore.kernel.org/r/20251006095124.1663-3-Arunpravin.PaneerSelvam@amd.com
drivers/gpu/drm/tests/drm_buddy_test.c