sna: Flush our caches if we fail to mmap an object

The likely cause for a mmap failure is that we hold too many objects
open or have exhausted our address space. In both cases, we need to trim
our caches before continuing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-02-06 16:37:21 +00:00
parent daba1ae3e7
commit 4b3b25f0be
1 changed files with 20 additions and 0 deletions

View File

@ -292,6 +292,11 @@ retry_gtt:
if (kgem_expire_cache(kgem))
goto retry_gtt;
if (kgem->need_expire) {
kgem_cleanup_cache(kgem);
goto retry_gtt;
}
return NULL;
}
@ -304,6 +309,11 @@ retry_mmap:
if (__kgem_throttle_retire(kgem, 0))
goto retry_mmap;
if (kgem->need_expire) {
kgem_cleanup_cache(kgem);
goto retry_mmap;
}
ptr = NULL;
}
@ -4559,6 +4569,11 @@ retry:
if (__kgem_throttle_retire(kgem, 0))
goto retry;
if (kgem->need_expire) {
kgem_cleanup_cache(kgem);
goto retry;
}
return NULL;
}
@ -4594,6 +4609,11 @@ retry:
if (__kgem_throttle_retire(kgem, 0))
goto retry;
if (kgem->need_expire) {
kgem_cleanup_cache(kgem);
goto retry;
}
return NULL;
}