From: Dave Chinner <david@fromorbit.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>,
Matthew Wilcox <willy@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/3] fs: Perform writebacks under memalloc_nofs
Date: Thu, 29 Mar 2018 10:57:02 +1100 [thread overview]
Message-ID: <20180328235702.GE1150@dastard> (raw)
In-Reply-To: <20180328070113.GA9275@dhcp22.suse.cz>
On Wed, Mar 28, 2018 at 09:01:13AM +0200, Michal Hocko wrote:
> On Tue 27-03-18 10:13:53, Goldwyn Rodrigues wrote:
> >
> >
> > On 03/27/2018 09:21 AM, Matthew Wilcox wrote:
> [...]
> > > Maybe no real filesystem behaves that way. We need feedback from
> > > filesystem people.
> >
> > The idea is to:
> > * Keep a central location for check, rather than individual filesystem
> > writepage(). It should reduce code as well.
> > * Filesystem developers call memory allocations without thinking twice
> > about which GFP flag to use: GFP_KERNEL or GFP_NOFS. In essence
> > eliminate GFP_NOFS.
>
> I do not think this is the right approach. We do want to eliminate
> explicit GFP_NOFS usage, but we also want to reduce the overal GFP_NOFS
> usage as well. The later requires that we drop the __GFP_FS only for
> those contexts that really might cause reclaim recursion problems.
As I've said before, moving to a scoped API will not reduce the
number of GFP_NOFS scope allocation points - removing individual
GFP_NOFS annotations doesn't do anything to avoid the deadlock paths
it protects against.
The issue is that GFP_NOFS is a big hammer - it stops reclaim from
all filesystem scopes, not just the one we hold locks on and are
doing the allocation for. i.e. we can be in one filesystem and quite
safely do reclaim from other filesystems. The global scope of
GFP_NOFS just doesn't allow this sort of fine-grained control to be
expressed in reclaim.
IOWs, if we want to reduce the scope of GFP_NOFS, we need a context
to be passed from allocation to reclaim so that the reclaim context
can check that it's a safe allocation context to reclaim from. e.g.
for GFP_NOFS, we can use the superblock of the allocating filesystem
as the context, and check it against the superblock that the current
reclaim context (e.g. shrinker invocation) belongs to. If they
match, we skip it. If they don't match, then we can perform reclaim
on that context.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-03-28 23:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 22:44 [PATCH 0/3] fs: Use memalloc_nofs_save/restore scope API Goldwyn Rodrigues
2018-03-21 22:44 ` [PATCH 1/3] fs: Perform writebacks under memalloc_nofs Goldwyn Rodrigues
2018-03-22 7:08 ` Michal Hocko
2018-03-27 12:52 ` Goldwyn Rodrigues
2018-03-27 14:21 ` Matthew Wilcox
2018-03-27 15:13 ` Goldwyn Rodrigues
2018-03-27 16:45 ` Matthew Wilcox
2018-03-28 7:01 ` Michal Hocko
2018-03-28 23:57 ` Dave Chinner [this message]
2018-03-29 7:01 ` Michal Hocko
2018-03-31 21:21 ` Dave Chinner
2018-03-21 22:44 ` [PATCH 2/3] fs: use memalloc_nofs API while shrinking superblock Goldwyn Rodrigues
2018-03-22 7:09 ` Michal Hocko
2018-03-21 22:44 ` [PATCH 3/3] fs: Use memalloc_nofs_save in generic_perform_write Goldwyn Rodrigues
2018-03-22 7:10 ` 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=20180328235702.GE1150@dastard \
--to=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=rgoldwyn@suse.de \
--cc=willy@infradead.org \
/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