linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: rientjes@google.com
Cc: mhocko@suse.cz, akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: oom: How to handle !__GFP_FS exception?
Date: Tue, 9 Jun 2015 20:48:30 +0900	[thread overview]
Message-ID: <201506092048.BII73411.MOVLQOHJFFFSOt@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <alpine.DEB.2.10.1506081252050.13272@chino.kir.corp.google.com>

David Rientjes wrote:
> On Sat, 6 Jun 2015, Tetsuo Handa wrote:
> 
> > For me, !__GFP_FS allocations not calling out_of_memory() _forever_ is a
> > violation of the user policy.
> > 
> 
> I agree that we need work in this area to prevent livelocks that rely on 
> the contexts of other allocators to make forward progress, but let's be 
> clear that panicking the system is not the appropriate response.  It's 
> nice and convenient to say we should repurpose panic_on_oom to solve 
> livelocks because it triggers a fast reboot in your configuration, but we, 
> and certainly others, can't tolerate reboots when the kernel just gives up 
> and the majority of the time these situations do resolve themselves.
> 
> I think the appropriate place to be attacking this problem is in the page 
> allocator, which is responsible for the page allocations in the context of 
> the gfp flags given to it, and not the oom killer.  The oom killer is just 
> supposed to pick a process, send it a SIGKILL, and give it a reasonable 
> expectation of being able to exit.
> 
> > If kswapd found nothing more to reclaim and/or kswapd cannot continue
> > reclaiming due to lock dependency, can't we consider as out of memory
> > because we already tried to reclaim memory which would have been done by
> > __GFP_FS allocations?
> > 
> > Why do we do "!__GFP_FS allocations do not call out_of_memory() because
> > they have very limited reclaim ability"? Both GFP_NOFS and GFP_NOIO
> > allocations will wake up kswapd due to !__GFP_NO_KSWAPD, doesn't it?
> > 
> 
> The !__GFP_FS exception is historic because the oom killer would trigger 
> waaay too often if it were removed simply because it doesn't have a great 
> chance of allowing reclaim to succeed.  Instead, we rely on external 
> memory freeing or other parallel allocators being able to reclaim memory.  
> What happens when there is no external freeing, nothing else is trying to 
> reclaim, or nothing else is able to reclaim?  Yeah, that's the big 
> problem.  In my opinion, there's three ways of attacking it: (1) 
> preallocation so we are less dependent on the page allocator in these 
> contexts, (2) memory reserves in extraordinary circumstances to allow 
> forward progress (it's already tunable by min_free_kbytes), and (3) 
> eventual page allocation failure when neither of these succeed.
> 
According to my observations (as posted at
http://marc.info/?l=linux-mm&m=143239200805478 ), (3) is dangerous because
it can potentially kill critical processes including global init process.
Killing a process by invoking the OOM killer sounds safer than (3).

Regarding (2), how can we selectively allow blocking process to access
memory reserves? Since we don't know the dependency, we can't identify the
process which should be allowed to access memory reserves. If we allow all
processes to access memory reserves, unrelated processes could deplete the
memory reserves while the blocking process is waiting for a lock (either in
killable or unkillable state). What we need to do to make forward progress
is not always to allow access to memory reserves. Sometimes making locks
killable (as posted at http://marc.info/?l=linux-mm&m=142408937117294 )
helps more.

Regarding (1), it would help but insufficient because (2) and (3) unlikely
work.

  reply	other threads:[~2015-06-09 11:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 11:59 [PATCH] oom: always panic on OOM when panic_on_oom is configured Michal Hocko
2015-06-01 15:12 ` Eric B Munson
2015-06-04 23:12 ` David Rientjes
2015-06-05 11:13   ` Michal Hocko
2015-06-06  6:51     ` Tetsuo Handa
2015-06-08  8:21       ` Michal Hocko
2015-06-08 11:53         ` Tetsuo Handa
2015-06-08 19:58       ` David Rientjes
2015-06-09 11:48         ` Tetsuo Handa [this message]
2015-06-09 22:41           ` oom: How to handle !__GFP_FS exception? David Rientjes
2015-06-08 19:51     ` [PATCH] oom: always panic on OOM when panic_on_oom is configured David Rientjes
2015-06-08 21:32       ` Michal Hocko
2015-06-08 23:20         ` David Rientjes
2015-06-09  9:43           ` Michal Hocko
2015-06-09 22:28             ` David Rientjes
2015-06-10  7:52               ` Michal Hocko
2015-06-11  0:36                 ` David Rientjes

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=201506092048.BII73411.MOVLQOHJFFFSOt@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).