The intention of returning ENOSPC for a page allocation failure due to
memory exhausstion in shmem_getpage_gfp() is purely "so that a failure
on a sparse tmpfs mapping will give SIGBUS not OOM." However, for other
callers, for example i915.ko, we want to distinguish the error message
reported to userspace between ENOSPC (meaning that we were unable to fit
the object/execbuffer into the aperture) and ENOMEM (meaning that we
were unable to allocate pages for the object).

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Hugh Dickins <hu...@google.com>
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 1f18c9d0d93e..142b0bc085e1 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1179,7 +1179,7 @@ repeat:
 
        } else {
                if (shmem_acct_block(info->flags)) {
-                       error = -ENOSPC;
+                       error = fault_type ? -ENOSPC : -ENOMEM;
                        goto failed;
                }
                if (sbinfo->max_blocks) {
-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to