All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Hugh Dickins <hughd@google.com>
Subject: [PATCH 1/5] shmemfs: Report ENOMEM for page allocation failures outside of tmpfs faults
Date: Wed,  5 Mar 2014 11:44:34 +0000	[thread overview]
Message-ID: <1394019878-25979-2-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1394019878-25979-1-git-send-email-chris@chris-wilson.co.uk>

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

  reply	other threads:[~2014-03-05 11:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 11:44 Shrinker improvements Chris Wilson
2014-03-05 11:44 ` Chris Wilson [this message]
2014-03-06  3:14   ` [PATCH 1/5] shmemfs: Report ENOMEM for page allocation failures outside of tmpfs faults Hugh Dickins
2014-03-06  9:05     ` Chris Wilson
2014-03-11 10:09       ` Hugh Dickins
2014-03-05 11:44 ` [PATCH 2/5] shmemfs: Use redirty_page_for_writepage() Chris Wilson
2014-03-06  4:06   ` Hugh Dickins
2014-03-06  8:57     ` Chris Wilson
2014-03-05 11:44 ` [PATCH 3/5] drm/i915: Include bound and active pages in the count of shrinkable objects Chris Wilson
2014-03-05 11:44 ` [PATCH 4/5] drm/i915: Refactor common lock handling between shrinker count/scan Chris Wilson
2014-03-05 11:44 ` [PATCH 5/5] drm/i915: Writeback our pages under memory pressure Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394019878-25979-2-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=hughd@google.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.