]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
gpu/buddy: bail out of try_harder when alignment cannot be honoured
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Thu, 9 Jul 2026 13:10:50 +0000 (18:40 +0530)
committerArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Thu, 9 Jul 2026 13:19:49 +0000 (18:49 +0530)
commit56bc6384314fb9ae98975fb2af8b143097ede3dc
treea255205ac49ed748b9a0f697e93701422b0183a6
parent06c2b8d7ea2bcb014dd974fc3bc6d128d65d7477
gpu/buddy: bail out of try_harder when alignment cannot be honoured

The try_harder contiguous fallback could return a range whose start
offset did not match the caller's min_block_size. When a candidate's
start is misaligned, realign it: free the misaligned run and reallocate
exactly @size at the next lower min_block_size boundary. This keeps the
returned size unchanged with no surplus to trim, and rejects the request
only when no aligned candidate fits.

v2: align misaligned candidates down to min_block_size instead of
    bailing out, for both the RHS and LHS paths (Matthew).

Fixes: 0a1844bf0b53 ("drm/buddy: Improve contiguous memory allocation")
Suggested-by: Christian König <christian.koenig@amd.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Timur Kristóf <timur.kristof@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Tested-by: John Olender <john.olender@gmail.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patch.msgid.link/20260709131050.1022759-1-Arunpravin.PaneerSelvam@amd.com
drivers/gpu/buddy.c