mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
nouveau: find the smallest page allocation to cover a buffer alloc.
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@vger.kernel.org # v6.6 Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Signed-off-by: Danilo Krummrich <dakr@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230811031520.248341-1-airlied@gmail.com
This commit is contained in:
parent
b9c02e1052
commit
e9ba37d9f9
@ -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))
|
(!vmm->page[i].host || vmm->page[i].shift > PAGE_SHIFT))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pi < 0)
|
/* pick the last one as it will be smallest. */
|
||||||
pi = i;
|
pi = i;
|
||||||
|
|
||||||
/* Stop once the buffer is larger than the current page size. */
|
/* Stop once the buffer is larger than the current page size. */
|
||||||
if (*size >= 1ULL << vmm->page[i].shift)
|
if (*size >= 1ULL << vmm->page[i].shift)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user