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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux