lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] fs: judging context via current_is_kswapd instead of gfp_flag
On Thu, Dec 9, 2021 at 4:26 AM David Howells <dhowells@redhat.com> wrote:
>
> 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
If the gfp flag here is used for judging kswapd context, I think the
answer is yes as kswapd applied __GFP_DIRECT_RECLAIM.
>

\
 
 \ /
  Last update: 2021-12-10 02:20    [W:0.178 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site