mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
anv/allocator: Don't ever call mremap
This has always been a bit sketchy and neither Kristian nor I have ever really liked it.
This commit is contained in:
parent
99e62f5ce8
commit
e1a7c721d3
1 changed files with 12 additions and 17 deletions
|
|
@ -421,23 +421,18 @@ anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state)
|
|||
goto fail;
|
||||
*cleanup = ANV_MMAP_CLEANUP_INIT;
|
||||
|
||||
/* First try to see if mremap can grow the map in place. */
|
||||
map = MAP_FAILED;
|
||||
if (old_size > 0 && center_bo_offset == 0)
|
||||
map = mremap(pool->map, old_size, size, 0);
|
||||
if (map == MAP_FAILED) {
|
||||
/* Just leak the old map until we destroy the pool. We can't munmap it
|
||||
* without races or imposing locking on the block allocate fast path. On
|
||||
* the whole the leaked maps adds up to less than the size of the
|
||||
* current map. MAP_POPULATE seems like the right thing to do, but we
|
||||
* should try to get some numbers.
|
||||
*/
|
||||
map = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_POPULATE, pool->fd,
|
||||
BLOCK_POOL_MEMFD_CENTER - center_bo_offset);
|
||||
cleanup->map = map;
|
||||
cleanup->size = size;
|
||||
}
|
||||
/* Just leak the old map until we destroy the pool. We can't munmap it
|
||||
* without races or imposing locking on the block allocate fast path. On
|
||||
* the whole the leaked maps adds up to less than the size of the
|
||||
* current map. MAP_POPULATE seems like the right thing to do, but we
|
||||
* should try to get some numbers.
|
||||
*/
|
||||
map = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_POPULATE, pool->fd,
|
||||
BLOCK_POOL_MEMFD_CENTER - center_bo_offset);
|
||||
cleanup->map = map;
|
||||
cleanup->size = size;
|
||||
|
||||
if (map == MAP_FAILED)
|
||||
goto fail;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue