Re: [PATCH v2 for-akpm for-6.14-rcX] NFS: fix nfs_release_folio() to not deadlock via kcompactd writeback

Mike Snitzer
2025-02-25T17:02:40Z

On Mon, Feb 24, 2025 at 10:53:06PM -0800, Andrew Morton wrote:
> On Mon, 24 Feb 2025 21:20:02 -0500 Mike Snitzer <snitzer@kernel.org> 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.
> >
>
> --- a/mm/compaction.c~a
> +++ a/mm/compaction.c
> @@ -3182,7 +3182,7 @@ static int kcompactd(void *p)
> long default_timeout = msecs_to_jiffies(HPAGE_FRAG_CHECK_INTERVAL_MSEC);
> long timeout = default_timeout;
>
> - tsk->flags |= PF_KCOMPACTD;
> + current->flags |= PF_KCOMPACTD;
> set_freezable();
>
> pgdat->kcompactd_max_order = 0;
> @@ -3239,7 +3239,7 @@ static int kcompactd(void *p)
> pgdat->proactive_compact_trigger = false;
> }
>
> - tsk->flags &= ~PF_KCOMPACTD;
> + current->flags &= ~PF_KCOMPACTD;
>
> return 0;
> }
>
> I am of course concerned about how well tested this was!

Understandable, the patch was created and tested against v6.12.16.
Sincere apologies, I didn't rebase before submitting.

I'll rebase, retest and then send v3 today.

Thanks,
Mike