From: Theodore Ts'o <tytso@mit.edu>
To: Michal Hocko <mhocko@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>,
Nikolay Borisov <kernel@kyup.com>,
linux-ext4@vger.kernel.org, Marian Marinov <mm@1h.com>
Subject: Re: Lockup in wait_transaction_locked under memory pressure
Date: Wed, 1 Jul 2015 07:13:55 -0400 [thread overview]
Message-ID: <20150701111355.GA22423@thunk.org> (raw)
In-Reply-To: <20150701061014.GA6286@dhcp22.suse.cz>
On Wed, Jul 01, 2015 at 08:10:14AM +0200, Michal Hocko wrote:
> On Wed 01-07-15 08:58:51, Dave Chinner wrote:
> [...]
> > *blink*
> >
> > /me re-reads again
> >
> > That assumption is fundamentally broken. Filesystems use GFP_NOFS
> > because the filesystem holds resources that can prevent memory
> > reclaim making forwards progress if it re-enters the filesystem or
> > blocks on anything filesystem related. memcg does not change that,
> > and I'm kinda scared to learn that memcg plays fast and loose like
> > this.
> >
> > For example: IO completion might require unwritten extent conversion
> > which executes filesystem transactions and GFP_NOFS allocations. The
> > writeback flag on the pages can not be cleared until unwritten
> > extent conversion completes. Hence memory reclaim cannot wait on
> > page writeback to complete in GFP_NOFS context because it is not
> > safe to do so, memcg reclaim or otherwise.
>
> Thanks for the clarification.
Perhaps we need to make the documentation a bit more explicit?
All which is stated in include/slab.h:
* %GFP_NOIO - Do not do any I/O at all while trying to get memory.
*
* %GFP_NOFS - Do not make any fs calls while trying to get memory.
I thought this was obvious, but these flags are used by code which in
the I/O or FS paths, and so it's always possible that they are trying
to write back the page which you decide to blocking on when trying to
do the memory allocation, at which point, *boom*, deadlock.
So it's just not "do not make any FS or I/O calls", but also "the mm
layer must not not wait for any FS or I/O operations from completing,
since the operation you block on might be the one they were in the
middle of trying to complete --- or they may be holding a lock at the
time when they were trying to do a memory allocation which blocks the
I/O or FS operation from completing".
- Ted
next prev parent reply other threads:[~2015-07-01 11:13 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <558BD447.1010503@kyup.com>
2015-06-25 10:16 ` Lockup in wait_transaction_locked under memory pressure Nikolay Borisov
2015-06-25 11:21 ` Michal Hocko
2015-06-25 11:43 ` Nikolay Borisov
2015-06-25 11:50 ` Michal Hocko
2015-06-25 12:05 ` Nikolay Borisov
2015-06-25 13:29 ` Nikolay Borisov
2015-06-25 13:45 ` Michal Hocko
2015-06-25 13:54 ` Nikolay Borisov
2015-06-25 13:58 ` Michal Hocko
2015-06-25 13:31 ` Theodore Ts'o
2015-06-25 13:49 ` Nikolay Borisov
2015-06-25 14:05 ` Michal Hocko
2015-06-25 14:34 ` Nikolay Borisov
2015-06-25 15:18 ` Michal Hocko
2015-06-25 15:27 ` Nikolay Borisov
2015-06-29 8:32 ` Michal Hocko
2015-06-29 9:07 ` Nikolay Borisov
2015-06-29 9:16 ` Michal Hocko
2015-06-29 9:23 ` Nikolay Borisov
2015-06-29 9:38 ` Michal Hocko
2015-06-29 10:21 ` Nikolay Borisov
2015-06-29 11:44 ` Michal Hocko
2015-06-25 14:45 ` Theodore Ts'o
2015-06-25 13:57 ` Michal Hocko
2015-06-29 9:01 ` Nikolay Borisov
2015-06-29 9:36 ` Michal Hocko
2015-06-30 1:52 ` Dave Chinner
2015-06-30 3:02 ` Theodore Ts'o
2015-06-30 6:35 ` Nikolay Borisov
2015-06-30 12:30 ` Michal Hocko
2015-06-30 14:31 ` Michal Hocko
2015-06-30 22:58 ` Dave Chinner
2015-07-01 6:10 ` Michal Hocko
2015-07-01 11:13 ` Theodore Ts'o [this message]
2015-07-01 14:21 ` 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=20150701111355.GA22423@thunk.org \
--to=tytso@mit.edu \
--cc=david@fromorbit.com \
--cc=kernel@kyup.com \
--cc=linux-ext4@vger.kernel.org \
--cc=mhocko@suse.cz \
--cc=mm@1h.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).