Skip to contentSkip to conversation

kernel: update callers of task_work_add() to use TWA_RESUME

PATCH In review Jens Axboe 3 participants 6 messages Aug 8, 2020 – Aug 10, 2020

Subsystems (13)
x86 VFS ACPI perf events +9 more subsystems
lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 kernel: update callers of task_work_add() to use TWA_RESUME

Any pre-existing caller of this function uses 'true' to signal to use notifications or not, but we now also have signaled notifications. Update existing callers that specify 'true' for notify to use the updated TWA_RESUME instead.

This was noted in the original commit as well:

e91b48162332 ("task_work: teach task_work_add() to do signal_wake_up()")

Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>

---

arch/x86/kernel/cpu/mce/core.c +1 -1
index 14e4b4d17ee5..615a34d697df 100644
@@ -1345,7 +1345,7 @@ void noinstr do_machine_check(struct pt_regs *regs)
 		current->mce_kill_me.func = kill_me_maybe;
 		if (kill_it)
 			current->mce_kill_me.func = kill_me_now;
-		task_work_add(current, &current->mce_kill_me, true);
+		task_work_add(current, &current->mce_kill_me, TWA_RESUME);
 	} else {
 		/*
 		 * Handle an MCE which has happened in kernel space but from
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -1
index 3f844f14fc0a..2c022eee122d 100644
@@ -561,7 +561,7 @@ static int __rdtgroup_move_task(struct task_struct *tsk,
 	 * callback has been invoked.
 	 */
 	atomic_inc(&rdtgrp->waitcount);
-	ret = task_work_add(tsk, &callback->work, true);
+	ret = task_work_add(tsk, &callback->work, TWA_RESUME);
 	if (ret) {
 		/*
 		 * Task is exiting. Drop the refcount and free the callback.
drivers/acpi/apei/ghes.c +1 -1
index 81bf71b10d44..8360f8d6be65 100644
@@ -879,7 +879,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work)
 			estatus_node->task_work.func = ghes_kick_task_work;
 			estatus_node->task_work_cpu = smp_processor_id();
 			ret = task_work_add(current, &estatus_node->task_work,
-					    true);
+					    TWA_RESUME);
 			if (ret)
 				estatus_node->task_work.func = NULL;
 		}
drivers/android/binder.c +1 -1
index f50c5f182bb5..d4a11eaeed91 100644
@@ -2251,7 +2251,7 @@ static void binder_deferred_fd_close(int fd)
 	__close_fd_get_file(fd, &twcb->file);
 	if (twcb->file) {
 		filp_close(twcb->file, current->files);
-		task_work_add(current, &twcb->twork, true);
+		task_work_add(current, &twcb->twork, TWA_RESUME);
 	} else {
 		kfree(twcb);
 	}
fs/file_table.c +1 -1
index 656647f9575a..709ada3151da 100644
@@ -339,7 +339,7 @@ void fput_many(struct file *file, unsigned int refs)
 
 		if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) {
 			init_task_work(&file->f_u.fu_rcuhead, ____fput);
-			if (!task_work_add(task, &file->f_u.fu_rcuhead, true))
+			if (!task_work_add(task, &file->f_u.fu_rcuhead, TWA_RESUME))
 				return;
 			/*
 			 * After this task has run exit_task_work(),
fs/namespace.c +1 -1
index 4a0f600a3328..8b072349fe28 100644
@@ -1191,7 +1191,7 @@ static void mntput_no_expire(struct mount *mnt)
 		struct task_struct *task = current;
 		if (likely(!(task->flags & PF_KTHREAD))) {
 			init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
-			if (!task_work_add(task, &mnt->mnt_rcu, true))
+			if (!task_work_add(task, &mnt->mnt_rcu, TWA_RESUME))
 				return;
 		}
 		if (llist_add(&mnt->mnt_llist, &delayed_mntput_list))
kernel/events/uprobes.c +1 -1
index 5f8b0c52fd2e..10e35c08b44d 100644
@@ -1823,7 +1823,7 @@ void uprobe_copy_process(struct task_struct *t, unsigned long flags)
 
 	t->utask->dup_xol_addr = area->vaddr;
 	init_task_work(&t->utask->dup_xol_work, dup_xol_work);
-	task_work_add(t, &t->utask->dup_xol_work, true);
+	task_work_add(t, &t->utask->dup_xol_work, TWA_RESUME);
 }
 
 /*
kernel/sched/fair.c +1 -1
index 2ba8f230feb9..cce1ab6b62a9 100644
@@ -2923,7 +2923,7 @@ static void task_tick_numa(struct rq *rq, struct task_struct *curr)
 		curr->node_stamp += period;
 
 		if (!time_before(jiffies, curr->mm->numa_next_scan))
-			task_work_add(curr, work, true);
+			task_work_add(curr, work, TWA_RESUME);
 	}
 }
 
security/keys/keyctl.c +1 -1
index 9febd37a168f..ed86310ffcd4 100644
@@ -1693,7 +1693,7 @@ long keyctl_session_to_parent(void)
 
 	/* the replacement session keyring is applied just prior to userspace
 	 * restarting */
-	ret = task_work_add(parent, newwork, true);
+	ret = task_work_add(parent, newwork, TWA_RESUME);
 	if (!ret)
 		newwork = NULL;
 unlock:
security/yama/yama_lsm.c +1 -1
index 536c99646f6a..06e226166aab 100644
@@ -99,7 +99,7 @@ static void report_access(const char *access, struct task_struct *target,
 	info->access = access;
 	info->target = target;
 	info->agent = agent;
-	if (task_work_add(current, &info->work, true) == 0)
+	if (task_work_add(current, &info->work, TWA_RESUME) == 0)
 		return; /* success */
 
 	WARN(1, "report_access called from exiting task");
Signature · 1 line
Jens Axboe
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jens Axboe

Any pre-existing caller of this function uses 'true' to signal to use notifications or not, but we now also have signaled notifications. Update existing callers that specify 'true' for notify to use the updated TWA_RESUME instead.

Thanks,

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Jens Axboe
Quoted 5 lines · Jens Axboe

Any pre-existing caller of this function uses 'true' to signal to use notifications or not, but we now also have signaled notifications. Update existing callers that specify 'true' for notify to use the updated TWA_RESUME instead.

Quoted 8 lines

This was noted in the original commit as well:

e91b48162332 ("task_work: teach task_work_add() to do signal_wake_up()")

Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>

How do you want to route this?

author
#3 lore raw
Quoted 10 lines · On 8/10/20 5:44 AM, [email protected] wrote:
Quoted 9 lines · Jens Axboe

Any pre-existing caller of this function uses 'true' to signal to use notifications or not, but we now also have signaled notifications. Update existing callers that specify 'true' for notify to use the updated TWA_RESUME instead.

This was noted in the original commit as well:

e91b48162332 ("task_work: teach task_work_add() to do signal_wake_up()")

Quoted 8 lines
Quoted 4 lines
Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>

How do you want to route this?

I don't really care, as I have no dependencies on it. Feel free to queue it up! It's just sitting at the top of my io_uring branch right now, but that's because I had to stuff it somewhere. Easy to pop off the top.

Signature · 1 line
Jens Axboe
author
#4 lore raw
Quoted 16 lines · Jens Axboe
Quoted 15 lines · On 8/10/20 5:44 AM, [email protected] wrote:
Quoted 13 lines · Jens Axboe

Any pre-existing caller of this function uses 'true' to signal to use notifications or not, but we now also have signaled notifications. Update existing callers that specify 'true' for notify to use the updated TWA_RESUME instead.

This was noted in the original commit as well:

e91b48162332 ("task_work: teach task_work_add() to do signal_wake_up()")

Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>
Quoted 7 lines
Quoted 3 lines

How do you want to route this?

I don't really care, as I have no dependencies on it. Feel free to queue it up! It's just sitting at the top of my io_uring branch right now, but that's because I had to stuff it somewhere. Easy to pop off the top.

FWIW, I dropped this from my branch, so would be great if you or Oleg could push this one upstream.

Signature · 1 line
Jens Axboe
maintainer
#5 lore raw
Quoted 19 lines · Jens Axboe
Quoted 18 lines · Jens Axboe
Quoted 17 lines · On 8/10/20 5:44 AM, [email protected] wrote:
Quoted 5 lines · Jens Axboe

Any pre-existing caller of this function uses 'true' to signal to use notifications or not, but we now also have signaled notifications. Update existing callers that specify 'true' for notify to use the updated TWA_RESUME instead.

Quoted 8 lines

This was noted in the original commit as well:

e91b48162332 ("task_work: teach task_work_add() to do signal_wake_up()")

Cc Oleg Nesterov <[email protected]>
Cc Peter Zijlstra <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

How do you want to route this?

I don't really care, as I have no dependencies on it. Feel free to queue it up! It's just sitting at the top of my io_uring branch right now, but that's because I had to stuff it somewhere. Easy to pop off the top.

FWIW, I dropped this from my branch, so would be great if you or Oleg could push this one upstream.

Will do, thanks!