This is a note to let you know that I've just added the patch titled nouveau: find the smallest page allocation to cover a buffer alloc. to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nouveau-find-the-smallest-page-allocation-to-cover-a-buffer-alloc.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e9ba37d9f9a6872b069dd893bd86a7d77ba8c153 Mon Sep 17 00:00:00 2001 From: Dave Airlie <airlied@xxxxxxxxxx> Date: Fri, 11 Aug 2023 13:15:20 +1000 Subject: nouveau: find the smallest page allocation to cover a buffer alloc. From: Dave Airlie <airlied@xxxxxxxxxx> commit e9ba37d9f9a6872b069dd893bd86a7d77ba8c153 upstream. With the new uapi we don't have the comp flags on the allocation, so we shouldn't be using the first size that works, we should be iterating until we get the correct one. This reduces allocations from 2MB to 64k in lots of places. Fixes dEQP-VK.memory.allocation.basic.size_8KiB.forward.count_4000 on my ampere/gsp system. Cc: stable@xxxxxxxxxxxxxxx # v6.6 Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx> Reviewed-by: Faith Ekstrand <faith.ekstrand@xxxxxxxxxxxxx> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20230811031520.248341-1-airlied@xxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 0f3bd187ede6..280d1d9a559b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -318,8 +318,9 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain, (!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT)) continue; - if (pi < 0) - pi = i; + /* pick the last one as it will be smallest. */ + pi = i; + /* Stop once the buffer is larger than the current page size. */ if (*size >= 1ULL << vmm->page[i].shift) break; -- 2.43.0 Patches currently in stable-queue which might be from airlied@xxxxxxxxxx are queue-6.6/nouveau-find-the-smallest-page-allocation-to-cover-a-buffer-alloc.patch