iris: Align fresh BO allocations to 2MB in size

This should allow us to use 64K pages in more cases, and since the
suballocator is typically used for BOs smaller than 2MB, it probably
isn't going to waste a horrendous amount of memory.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25447>
This commit is contained in:
Kenneth Graunke 2023-09-27 18:53:58 -07:00 committed by Marge Bot
parent 6932827a47
commit 0b6693a3a1

View file

@ -1067,6 +1067,15 @@ alloc_fresh_bo(struct iris_bufmgr *bufmgr, uint64_t bo_size, unsigned flags)
if (!bo)
return NULL;
/* Try to allocate memory in multiples of 2MB, as this allows us to use
* 64K pages rather than the less-efficient 4K pages. Most BOs smaller
* than 64MB should hit the BO cache or slab allocations anyway, so this
* shouldn't waste too much memory. We do exclude small (< 1MB) sizes to
* be defensive in case any of those bypass the caches and end up here.
*/
if (bo_size >= 1024 * 1024)
bo_size = ALIGN(bo_size, 2 * 1024 * 1024);
bo->real.heap = flags_to_heap(bufmgr, flags);
const struct intel_memory_class_instance *regions[2];