On 22/12/2025 06:52, Sanjay Yadav wrote:
Add kunit tests that exercise edge cases where allocation requests
exceed mm->max_order after rounding. This can happen with
non-power-of-two VRAM sizes when the allocator rounds up requests.

For example, with 10G VRAM (8G + 2G roots), mm->max_order represents
the 8G block. A 9G allocation can round up to 16G in multiple ways:
CONTIGUOUS allocation rounds to next power-of-two, or non-CONTIGUOUS
with 8G min_block_size rounds to next alignment boundary.

The test validates CONTIGUOUS and RANGE flag combinations, ensuring that
only CONTIGUOUS-alone allocations use try_harder fallback, while other
combinations return -EINVAL when rounded size exceeds memory, preventing
BUG_ON assertions.

Cc: Christian König <[email protected]>
Cc: Arunpravin Paneer Selvam <[email protected]>
Suggested-by: Matthew Auld <[email protected]>
Signed-off-by: Sanjay Yadav <[email protected]>

Reviewed-by: Matthew Auld <[email protected]>

Reply via email to