@@ -477,7 +477,7 @@ void fput(struct file *file)
file_free(file);
return;
}
- if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) {
+ if (likely(!in_interrupt() && !(task->flags & PF_NO_TASKWORK))) {
init_task_work(&file->f_task_work, ____fput);
if (!task_work_add(task, &file->f_task_work, TWA_RESUME))
return;
@@ -1635,7 +1635,7 @@ extern struct pid *cad_pid;
#define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */
#define PF_USER_WORKER 0x00004000 /* Kernel thread cloned from userspace thread */
#define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */
-#define PF__HOLE__00010000 0x00010000
+#define PF_NO_TASKWORK 0x00010000 /* task doesn't run task_work */
#define PF_KSWAPD 0x00020000 /* I am kswapd */
#define PF_MEMALLOC_NOFS 0x00040000 /* All allocations inherit GFP_NOFS. See memalloc_nfs_save() */
#define PF_MEMALLOC_NOIO 0x00080000 /* All allocations inherit GFP_NOIO. See memalloc_noio_save() */
@@ -2222,7 +2222,7 @@ __latent_entropy struct task_struct *copy_process(
goto fork_out;
p->flags &= ~PF_KTHREAD;
if (args->kthread)
- p->flags |= PF_KTHREAD;
+ p->flags |= PF_KTHREAD | PF_NO_TASKWORK;
if (args->user_worker) {
/*
* Mark us a user worker, and block any signal that isn't
Rather than hardwire this to kernel threads, add a task flag that tells us whether the task in question runs task_work or not. At fork time, this flag is set for kernel threads. This is in preparation for allowing kernel threads to signal that they will run deferred task_work. No functional changes in this patch. Signed-off-by: Jens Axboe <axboe@kernel.dk> --- fs/file_table.c | 2 +- include/linux/sched.h | 2 +- kernel/fork.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)