[Intel-gfx] [PATCH 1/5] shmemfs: Report ENOMEM for page allocation failures outside of tmpfs faults

Chris Wilson chris at chris-wilson.co.uk
Wed Mar 5 12:44:34 CET 2014


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 <chris at chris-wilson.co.uk>
Cc: Hugh Dickins <hughd at 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




More information about the Intel-gfx mailing list