[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140904090512.GL20473@dastard>
Date: Thu, 4 Sep 2014 19:05:12 +1000
From: Dave Chinner <david@...morbit.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Junxiao Bi <junxiao.bi@...cle.com>, xuejiufei@...wei.com,
ming.lei@...onical.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] mm: clear __GFP_FS when PF_MEMALLOC_NOIO is set
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@...cle.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@...morbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists