linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: dchinner@redhat.com, oleg@redhat.com, xfs@oss.sgi.com,
	hannes@cmpxchg.org, linux-mm@kvack.org, mgorman@suse.de,
	rientjes@google.com, linux-fsdevel@vger.kernel.org,
	akpm@linux-foundation.org, fernando_b1@lab.ntt.co.jp,
	torvalds@linux-foundation.org
Subject: Re: How to handle TIF_MEMDIE stalls?
Date: Fri, 20 Feb 2015 10:13:26 +0100	[thread overview]
Message-ID: <20150220091326.GD21248@dhcp22.suse.cz> (raw)
In-Reply-To: <201502200029.DEG78137.QFVLHFFOJMtOOS@I-love.SAKURA.ne.jp>

On Fri 20-02-15 00:29:29, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > On Thu 19-02-15 13:29:14, Michal Hocko wrote:
> > [...]
> > > Something like the following.
> > __GFP_HIGH doesn't seem to be sufficient so we would need something
> > slightly else but the idea is still the same:
> > 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 8d52ab18fe0d..2d224bbdf8e8 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -2599,6 +2599,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
> >  	enum migrate_mode migration_mode = MIGRATE_ASYNC;
> >  	bool deferred_compaction = false;
> >  	int contended_compaction = COMPACT_CONTENDED_NONE;
> > +	int oom = 0;
> >  
> >  	/*
> >  	 * In the slowpath, we sanity check order to avoid ever trying to
> > @@ -2635,6 +2636,15 @@ retry:
> >  	alloc_flags = gfp_to_alloc_flags(gfp_mask);
> >  
> >  	/*
> > +	 * __GFP_NOFAIL allocations cannot fail but yet the current context
> > +	 * might be blocking resources needed by the OOM victim to terminate.
> > +	 * Allow the caller to dive into memory reserves to succeed the
> > +	 * allocation and break out from a potential deadlock.
> > +	 */
> 
> We don't know how many callers will pass __GFP_NOFAIL. But if 1000
> threads are doing the same operation which requires __GFP_NOFAIL
> allocation with a lock held, wouldn't memory reserves deplete?

We shouldn't have an unbounded number of GFP_NOFAIL allocations at the
same time. This would be even more broken. If a load is known to use
such allocations excessively then the administrator can enlarge the
memory reserves.

> This heuristic can't continue if memory reserves depleted or
> continuous pages of requested order cannot be found.

Once memory reserves are depleted we are screwed anyway and we might
panic.

-- 
Michal Hocko
SUSE Labs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2015-02-20  9:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150218082502.GA4478@dhcp22.suse.cz>
     [not found] ` <20150218104859.GM12722@dastard>
     [not found]   ` <20150218121602.GC4478@dhcp22.suse.cz>
     [not found]     ` <20150219110124.GC15569@phnom.home.cmpxchg.org>
     [not found]       ` <20150219122914.GH28427@dhcp22.suse.cz>
2015-02-19 13:29         ` How to handle TIF_MEMDIE stalls? Tetsuo Handa
2015-02-20  9:10           ` Michal Hocko
2015-02-20 12:20             ` Tetsuo Handa
2015-02-20 12:38               ` Michal Hocko
     [not found]         ` <20150219125844.GI28427@dhcp22.suse.cz>
2015-02-19 15:29           ` Tetsuo Handa
2015-02-19 21:53             ` Tetsuo Handa
2015-02-20  9:13             ` Michal Hocko [this message]
2015-02-20 13:37               ` Stefan Ring
     [not found] <201502172057.GCD09362.FtHQMVSLJOFFOO@I-love.SAKURA.ne.jp>
     [not found] ` <20150217131618.GA14778@phnom.home.cmpxchg.org>
     [not found]   ` <20150217165024.GI32017@dhcp22.suse.cz>
     [not found]     ` <20150217232552.GK4251@dastard>
     [not found]       ` <20150218084842.GB4478@dhcp22.suse.cz>
2015-02-18 11:23         ` Tetsuo Handa
2015-02-18 12:29           ` Michal Hocko
2015-02-18 14:06             ` Tetsuo Handa
2015-02-18 14:25               ` Michal Hocko
2015-02-19 10:48                 ` Tetsuo Handa
2015-02-20  8:26                   ` Michal Hocko

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=20150220091326.GD21248@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=dchinner@redhat.com \
    --cc=fernando_b1@lab.ntt.co.jp \
    --cc=hannes@cmpxchg.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=oleg@redhat.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rientjes@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xfs@oss.sgi.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).