]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/buddy: Add KUnit test for offset-aligned allocations
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Fri, 6 Mar 2026 06:01:55 +0000 (11:31 +0530)
committerArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Mon, 9 Mar 2026 07:06:31 +0000 (12:36 +0530)
commitf5bd7da05a5988506dedcb3e67aecb3a13a4cdf0
tree4f4225e182100502eb78e8c4352f81a0573d6a52
parent493740d790cce709d285cd1022d16d05439b7d5b
drm/buddy: Add KUnit test for offset-aligned allocations

Add KUnit test to validate offset-aligned allocations in the DRM buddy
allocator.

Validate offset-aligned allocation:
The test covers allocations with sizes smaller than the alignment constraint
and verifies correct size preservation, offset alignment, and behavior across
multiple allocation sizes. It also exercises fragmentation by freeing
alternating blocks and confirms that allocation fails once all aligned offsets
are consumed.

Stress subtree_max_alignment propagation:
Exercise subtree_max_alignment tracking by allocating blocks with descending
alignment constraints and freeing them in reverse order. This verifies that
free-tree augmentation correctly propagates the maximum offset alignment
present in each subtree at every stage.

v2:
  - Move the patch to gpu/tests/gpu_buddy_test.c file.

v3:
  - Fixed build warnings reported by kernel test robot <lkp@intel.com>

v4:(Matthew)
  - Use IS_ALIGNED() instead of manual alignment checks
  - Simplify order iteration loop for readability
  - Remove extra newline

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patch.msgid.link/20260306060155.2114-2-Arunpravin.PaneerSelvam@amd.com
drivers/gpu/tests/gpu_buddy_test.c