On 11/28, Christian Brauner wrote: > > Should be simpler if you invert the logic? > > COMPLETELY UNTESTED Agreed, this looks much better to me. But perhaps we can just add the new PF_KTHREAD_XXX flag and change fput --- a/fs/file_table.c +++ b/fs/file_table.c @@ -445,7 +445,8 @@ void fput(struct file *file) if (atomic_long_dec_and_test(&file->f_count)) { struct task_struct *task = current; - if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { + if (likely(!in_interrupt() && + task->flags & (PF_KTHREAD|PF_KTHREAD_XXX) != PF_KTHREAD) { init_task_work(&file->f_rcuhead, ____fput); if (!task_work_add(task, &file->f_rcuhead, TWA_RESUME)) return; ? Then nfsd() can simply set PF_KTHREAD_XXX. This looks even simpler to me. Oleg.