linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: hannes@cmpxchg.org, akpm@linux-foundation.org,
	alan@llwyncelyn.cymru, hch@lst.de, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] vmalloc: back off only when the current task is OOM killed
Date: Tue, 10 Oct 2017 16:17:33 +0200	[thread overview]
Message-ID: <20171010141733.juvbfjdglutehvie@dhcp22.suse.cz> (raw)
In-Reply-To: <201710102313.DBB60400.QOOVHLFJFOtMFS@I-love.SAKURA.ne.jp>

On Tue 10-10-17 23:13:21, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > On Tue 10-10-17 21:47:02, Tetsuo Handa wrote:
> > > I think that massive vmalloc() consumers should be (as well as massive
> > > alloc_page() consumers) careful such that they will be chosen as first OOM
> > > victim, for vmalloc() does not abort as soon as an OOM occurs.
> > 
> > No. This would require to spread those checks all over the place. That
> > is why we have that logic inside the allocator which fails the
> > allocation at certain point in time. Large/unbound/user controlled sized
> > allocations from the kernel are always a bug and really hard one to
> > protect from. It is simply impossible to know the intention.
> > 
> > > Thus, I used
> > > set_current_oom_origin()/clear_current_oom_origin() when I demonstrated
> > > "complete" depletion.
> > 
> > which was a completely artificial example as already mentioned.
> > 
> > > > I have tried to explain this is not really needed before but you keep
> > > > insisting which is highly annoying. The patch as is is not harmful but
> > > > it is simply _pointless_ IMHO.
> > > 
> > > Then, how can massive vmalloc() consumers become careful?
> > > Explicitly use __vmalloc() and pass __GFP_NOMEMALLOC ?
> > > Then, what about adding some comment like "Never try to allocate large
> > > memory using plain vmalloc(). Use __vmalloc() with __GFP_NOMEMALLOC." ?
> > 
> > Come on! Seriously we do expect some competence from the code running in
> > the kernel space. We do not really need to add a comment that you
> > shouldn't shoot your head because it might hurt. Please try to focus on
> > real issues. There are many of them to chase after...
> > 
> My understanding is that vmalloc() is provided for allocating large memory
> where kmalloc() is difficult to satisfy. If we say "do not allocate large
> memory with vmalloc() because large allocations from the kernel are always
> a bug", it sounds like denial of raison d'etre of vmalloc(). Strange...

try to find some middle ground between literal following the wording and
a common sense. In kernel anything larger than order-3 is a large
allocation. The large we are arguing here is MBs of memory.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-10-10 14:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 10:58 Tetsuo Handa
2017-10-10 11:54 ` Michal Hocko
2017-10-10 12:47   ` Tetsuo Handa
2017-10-10 13:49     ` Michal Hocko
2017-10-10 14:13       ` Tetsuo Handa
2017-10-10 14:17         ` Michal Hocko [this message]
2017-10-10 12:47 ` Johannes Weiner

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=20171010141733.juvbfjdglutehvie@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@llwyncelyn.cymru \
    --cc=hannes@cmpxchg.org \
    --cc=hch@lst.de \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox