All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Huangzhaoyang <huangzhaoyang@gmail.com>
Cc: dhowells@redhat.com, Marc Dionne <marc.dionne@auristor.com>,
	Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
	linux-cachefs@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: judging context via current_is_kswapd instead of gfp_flag
Date: Wed, 08 Dec 2021 20:26:46 +0000	[thread overview]
Message-ID: <2868725.1638995206@warthog.procyon.org.uk> (raw)
In-Reply-To: <1638952658-20285-1-git-send-email-huangzhaoyang@gmail.com>

Huangzhaoyang <huangzhaoyang@gmail.com> wrote:

[adding linux-cachefs to the cc list]

> Kswapd uses GFP_KERNEL as gfp_flag which make the judgment of
> context is unexpected. fix it by using current_is_kswapd.
> 
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> ---
>  fs/afs/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/afs/file.c b/fs/afs/file.c
> index eb11d04..6c199d5 100644
> --- a/fs/afs/file.c
> +++ b/fs/afs/file.c
> @@ -485,7 +485,7 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags)
>  	 * elected to wait */
>  #ifdef CONFIG_AFS_FSCACHE
>  	if (PageFsCache(page)) {
> -		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);
>  	}

I have several of these in my fscache-rewrite branch, spread across a number
of filesystems.  Should I fix all of them the same way?

fs/9p/vfs_addr.c:               if (!gfpflags_allow_blocking(gfp) || !(gfp & __GFP_FS))
fs/afs/file.c:          if (!gfpflags_allow_blocking(gfp) || !(gfp & __GFP_FS))
fs/nfs/file.c:          if (!gfpflags_allow_blocking(gfp) || !(gfp & __GFP_FS))
fs/nfs/fscache.h:               if (!gfpflags_allow_blocking(gfp) || !(gfp & __GFP_FS))

David


  reply	other threads:[~2021-12-08 20:26 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 [this message]
2021-12-10  1:19   ` Zhaoyang Huang
2021-12-21 15:00   ` David Howells
2021-12-22  8:02     ` Zhaoyang Huang

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=2868725.1638995206@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=huangzhaoyang@gmail.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.