OSDN Git Service

drm: Optimize drm buddy top-down allocation method
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Thu, 12 Jan 2023 12:00:27 +0000 (04:00 -0800)
committerChristian König <christian.koenig@amd.com>
Thu, 12 Jan 2023 12:50:28 +0000 (13:50 +0100)
commit5640e81607152d7f2d2558227c0f6cb78b8f39cf
treec4a43073a03b6745a8dea991b446445cd21301d7
parent040b35c19bf2bdbb8ba5f8742b4e199ace3cbdc3
drm: Optimize drm buddy top-down allocation method

We are observing performance drop in many usecases which include
games, 3D benchmark applications,etc.. To solve this problem, We
are strictly not allowing top down flag enabled allocations to
steal the memory space from cpu visible region.

The idea is, we are sorting each order list entries in
ascending order and compare the last entry of each order
list in the freelist and return the max block.

This patch improves the 3D benchmark scores and solves
fragmentation issues.

All drm buddy selftests are verfied.
drm_buddy: pass:6 fail:0 skip:0 total:6

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230112120027.3072-1-Arunpravin.PaneerSelvam@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>
CC: Cc: stable@vger.kernel.org # 5.18+
drivers/gpu/drm/drm_buddy.c