All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Lucas Stach <dev@lynxeye.de>
Cc: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	mhocko@kernel.org, Russell King <linux+etnaviv@armlinux.org.uk>
Subject: Re: [PATCH 1/3] drm/etnaviv: don't trigger OOM killer when page allocation fails
Date: Tue, 20 Jun 2017 11:06:10 +0200	[thread overview]
Message-ID: <20170620090610.sr2vi6wgkvbgai3g@phenom.ffwll.local> (raw)
In-Reply-To: <20170606071708.28229-1-dev@lynxeye.de>

On Tue, Jun 06, 2017 at 09:17:06AM +0200, Lucas Stach wrote:
> GPU buffers can be quite large, so userspace is expected to deal with
> allocation failure. Don't trigger the OOM killer when page allocation for
> the GEM objects fails, as this opens an easy possiblity for unprivileged
> applications to DOS the system,a s the shmem pages are not fully accounted
> to the allocating process.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> index f0efc5d..4c53508 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> @@ -662,7 +662,8 @@ static struct drm_gem_object *__etnaviv_gem_new(struct drm_device *dev,
>  		 * going to pin these pages.
>  		 */
>  		mapping = obj->filp->f_mapping;
> -		mapping_set_gfp_mask(mapping, GFP_HIGHUSER);
> +		mapping_set_gfp_mask(mapping, GFP_HIGHUSER |
> +				     __GFP_NORETRY | __GFP_NOWARN);

_NORETRY means the mm does try hard at all to free memory. We've just done
this patch in 4.12 and totally regret it, because now gpu tasks run out of
memory with plenty of (gpu) memory available that could be reaped.

There's some discussions going on with Michal Hocko and Chris Wilson
about possible solutions for this without so much hacks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-06-20  9:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  7:17 [PATCH 1/3] drm/etnaviv: don't trigger OOM killer when page allocation fails Lucas Stach
2017-06-06  7:17 ` [PATCH 2/3] drm/etnaviv: reduce allocation failure message severity Lucas Stach
2017-06-06  7:17 ` [PATCH 3/3] drm/etnaviv: populate GEM objects on cpu_prep Lucas Stach
2017-06-20  9:06 ` Daniel Vetter [this message]
2017-06-20  9:22   ` [PATCH 1/3] drm/etnaviv: don't trigger OOM killer when page allocation fails Lucas Stach
2017-06-20  9:25     ` Daniel Vetter
2017-06-26  5:52       ` Michal Hocko
2017-06-26  6:48         ` Lucas Stach

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=20170620090610.sr2vi6wgkvbgai3g@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dev@lynxeye.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=mhocko@kernel.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.