Re: [PATCH for-akpm for-6.14-rcX] NFS: fix nfs_release_folio() to not call nfs_wb_folio() from kcompactd

Trond Myklebust
2025-02-26T17:22:11Z

On Wed, 2025-02-26 at 06:58 -0800, Christoph Hellwig wrote:
> On Mon, Feb 24, 2025 at 07:33:01PM -0500, Mike Snitzer wrote:
> > Add PF_KCOMPACTD flag and current_is_kcompactd() helper to check
> > for
> > it so nfs_release_folio() can skip calling nfs_wb_folio() from
> > kcompactd.
> >
> > Otherwise NFS can deadlock waiting for kcompactd enduced writeback
> > which recurses back to NFS (which triggers writeback to NFSD via
> > NFS loopback mount on the same host, NFSD blocks waiting for XFS's
> > call to __filemap_get_folio):
>
> Having a flag for a specific kernel thread feels wrong.  I'm not an
> expert in this area, but as fast as I can tell the problem is that
> kcompactd should be calling into ->release_folio without __GFP_IO
> set.

I've had that conversation before with several mm folks before we added
the PF_KSWAPD flag, and they appeared to disagree.
However perhaps these daemons could set PF_MEMALLOC_NOFS before calling
into release_folio()?

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com