All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: Marc Dionne <marc.dionne@auristor.com>,
	Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
	linux-cachefs@redhat.com, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs: judging context via current_is_kswapd instead of gfp_flag
Date: Wed, 22 Dec 2021 16:02:18 +0800	[thread overview]
Message-ID: <CAGWkznGgyS5VrcuYkWR_7sbDOkr0k2mDNUwF6F6N-Y_3GGtoJA@mail.gmail.com> (raw)
In-Reply-To: <73896.1640098820@warthog.procyon.org.uk>

On Tue, Dec 21, 2021 at 11:01 PM David Howells <dhowells@redhat.com> wrote:
>
> Zhaoyang Huang <huangzhaoyang@gmail.com> wrote:
>
> > > > -             if (!(gfp_flags & __GFP_DIRECT_RECLAIM) || !(gfp_flags & __GFP_FS))
> > > > +             if (current_is_kswapd() || !(gfp_flags & __GFP_FS))
> > > >                       return false;
> > > >               wait_on_page_fscache(page);
> > ...
> > If the gfp flag here is used for judging kswapd context, I think the
> > answer is yes as kswapd applied __GFP_DIRECT_RECLAIM.
>
> Now I come to look at applying it, I'm not sure whether this change is right.
>
> I don't know if kswapd has anything to do with it.  The check is to see if
> we're allowed to block at this point - and wait is just for the completion of
> a DIO write to disk.
>
> It would seem like gfpflags_allow_blocking() is the right thing to call - and
> that should use current_is_kswapd() if appropriate.
>
> David
According to my understanding, this check is redundant according to
current vmscan logic. For the allocation which deny
__GFP_DIRECT_RECLAIM could NOT have the context reach here as there is
no synchronous reclaiming. while kswapd also has __GFP_DIRECT_RECLAIM
set and would also block on the page's release.
>

      reply	other threads:[~2021-12-22  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08  8:37 [PATCH] fs: judging context via current_is_kswapd instead of gfp_flag Huangzhaoyang
2021-12-08 20:26 ` David Howells
2021-12-10  1:19   ` Zhaoyang Huang
2021-12-21 15:00   ` David Howells
2021-12-22  8:02     ` Zhaoyang Huang [this message]

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=CAGWkznGgyS5VrcuYkWR_7sbDOkr0k2mDNUwF6F6N-Y_3GGtoJA@mail.gmail.com \
    --to=huangzhaoyang@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=zhaoyang.huang@unisoc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.