From: Dave Chinner <david@fromorbit.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: mhocko@kernel.org, hch@infradead.org, darrick.wong@oracle.com,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] xfs: handle register_shrinker error
Date: Sun, 26 Nov 2017 10:34:53 +1100 [thread overview]
Message-ID: <20171125233453.GX5858@dastard> (raw)
In-Reply-To: <201711242103.FIH57396.FOFVJtQFLSMOHO@I-love.SAKURA.ne.jp>
On Fri, Nov 24, 2017 at 09:03:28PM +0900, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > Thanks. Updated patch below
> > ---
> > From 1009db61988c48c9a9e327a9d076945b29b02eee Mon Sep 17 00:00:00 2001
> > From: Michal Hocko <mhocko@suse.com>
> > Date: Thu, 23 Nov 2017 17:13:40 +0100
> > Subject: [PATCH] xfs: fortify xfs_alloc_buftarg error handling
>
> Do we need below patch on top of Michal's patch?
> KM_NOFS was added by commit b17cb364dbbbf65a ("xfs: fix missing KM_NOFS
> tags to keep lockdep happy"). If not needed, some comment is expected.
Quite frankly, if the fix is "sprinkle magic undocumented
memalloc_nofs_save() calls around", then you need to think a little
more about the things you just read and the context we're operating
on here.
IOWs:
> ---
> fs/xfs/xfs_buf.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index 4c6e86d..b73fc76 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1806,6 +1806,7 @@ struct xfs_buf *
> struct dax_device *dax_dev)
> {
> xfs_buftarg_t *btp;
> + unsigned int nofs_flag = memalloc_nofs_save();
>
> btp = kmem_zalloc(sizeof(*btp), KM_SLEEP | KM_NOFS);
xfs_alloc_buftarg() isn't called from transaction context, so this
KM_NOFS flag wasn't added to prevent reclaim deadlocks - it was
added to avoid stupid lockdep false positives (as was stated in the
commit you quoted).
IOWs, GFP_KERNEL allocations in this function used to trigger
lockdep false positives.
So - think for a minute rather than bashing on the keyboard. Why
aren't the other GFP_KERNEL allocations from this function causing
lockdep to trigger warnings?
Yeah - lockdep is a lot smarter these days and the false positive
trigger has clearly been fixed. i.e. there's no false positive
detection occurring here any more under GFP_KERNEL allocations,
so we don't need the KM_NOFS flag anymore.
IOWs, we don't actually need to touch this code, but if you really
must, just remove the KM_NOFS tag.
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2017-11-25 23:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 12:08 [PATCH] xfs: handle register_shrinker error Michal Hocko
2017-11-23 13:26 ` Christoph Hellwig
2017-11-23 13:41 ` Michal Hocko
2017-11-23 16:01 ` Tetsuo Handa
2017-11-23 16:11 ` Michal Hocko
2017-11-23 16:17 ` Tetsuo Handa
2017-11-23 16:31 ` Michal Hocko
2017-11-23 22:00 ` Dave Chinner
2017-11-24 7:39 ` [PATCH v2] " Michal Hocko
2017-11-24 12:03 ` Tetsuo Handa
2017-11-24 12:09 ` Michal Hocko
2017-11-25 23:34 ` Dave Chinner [this message]
2017-11-26 2:14 ` Tetsuo Handa
2017-11-27 8:05 ` Michal Hocko
2017-11-27 17:44 ` Darrick J. Wong
2017-11-28 9:35 ` Michal Hocko
2017-11-28 16:39 ` Darrick J. Wong
2017-11-28 19:40 ` 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=20171125233453.GX5858@dastard \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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).