linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>,
	xuejiufei@huawei.com, ming.lei@canonical.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] mm: clear __GFP_FS when PF_MEMALLOC_NOIO is set
Date: Thu, 4 Sep 2014 19:05:12 +1000	[thread overview]
Message-ID: <20140904090512.GL20473@dastard> (raw)
In-Reply-To: <20140903161000.f383fa4c1a4086de054cb6a0@linux-foundation.org>

On Wed, Sep 03, 2014 at 04:10:00PM -0700, Andrew Morton wrote:
> On Wed,  3 Sep 2014 13:54:54 +0800 Junxiao Bi <junxiao.bi@oracle.com> wrote:
> 
> > commit 21caf2fc1931 ("mm: teach mm by current context info to not do I/O during memory allocation")
> > introduces PF_MEMALLOC_NOIO flag to avoid doing I/O inside memory allocation, __GFP_IO is cleared
> > when this flag is set, but __GFP_FS implies __GFP_IO, it should also be cleared. Or it may still
> > run into I/O, like in superblock shrinker.
> 
> Is there an actual bug which inspired this fix?  If so, please describe
> it.
> 
> I don't think it's accurate to say that __GFP_FS implies __GFP_IO. 
> Where did that info come from?

Pretty damn clear to me:

#define GFP_ATOMIC      (__GFP_HIGH)
#define GFP_NOIO        (__GFP_WAIT)
#define GFP_NOFS        (__GFP_WAIT | __GFP_IO)
#define GFP_KERNEL      (__GFP_WAIT | __GFP_IO | __GFP_FS)

especially when you consider the layering of the subsystems that use
these contexts. i.e. KERNEL on top of FS on top of IO on top of
ATOMIC....

IOWs, asking for (__GFP_WAIT | __GFP_FS) reclaim context is
something outside the defined reclaim heirarchy. Filesystems
*depend* on being about to do IO to perform recalim of dirty
objects, whether it be the page cache, inode cache or any other
filesystem cache that can hold dirty objects.

> And the superblock shrinker is a good example of why this shouldn't be
> the case.  The main thing that code does is to reclaim clean fs objects
> without performing IO.

Filesystem shrinkers do indeed perform IO from the superblock
shrinker and have for years. Even clean inodes can require IO before
they can be freed - e.g. on an orphan list, need truncation of
post-eof blocks, need to wait for ordered operations to complete
before it can be freed, etc.

IOWs, Ext4, btrfs and XFS all can issue and/or block on
arbitrary amounts of IO in the superblock shrinker context. XFS, in
particular, has been doing transactions and IO from the VFS inode
cache shrinker since it was first introduced....

> AFAICT the proposed patch will significantly
> weaken PF_MEMALLOC_NOIO allocation attempts by needlessly preventing
> the kernel from reclaiming such objects?

PF_MEMALLOC_NOIO is the anomolous case. It also has very few users,
who all happen to be working around very rare deadlocks caused by
vmalloc() hard coding GFP_KERNEL allocations deep in it's stack. So
the impact of fixing this anomoly is going to be completely
unnoticable...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

--
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>

  parent reply	other threads:[~2014-09-04  9:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03  5:54 [PATCH] mm: clear __GFP_FS when PF_MEMALLOC_NOIO is set Junxiao Bi
2014-09-03 12:20 ` Trond Myklebust
2014-09-04  2:18   ` Junxiao Bi
2014-09-03 23:10 ` Andrew Morton
2014-09-04  2:08   ` Junxiao Bi
2014-09-04  2:30     ` Andrew Morton
2014-09-04  4:57       ` Junxiao Bi
2014-09-04  8:05       ` Anton Altaparmakov
2014-09-04  9:21       ` Dave Chinner
2014-09-04  9:05   ` Dave Chinner [this message]
2014-09-04  9:23 ` Dave Chinner
2014-09-05  2:32   ` Junxiao Bi
2014-09-05  5:13     ` Junxiao Bi

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=20140904090512.GL20473@dastard \
    --to=david@fromorbit.com \
    --cc=akpm@linux-foundation.org \
    --cc=junxiao.bi@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ming.lei@canonical.com \
    --cc=xuejiufei@huawei.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).