Commit 91989c70 authored by Jens Axboe's avatar Jens Axboe
Browse files

task_work: cleanup notification modes



A previous commit changed the notification mode from true/false to an
int, allowing notify-no, notify-yes, or signal-notify. This was
backwards compatible in the sense that any existing true/false user
would translate to either 0 (on notification sent) or 1, the latter
which mapped to TWA_RESUME. TWA_SIGNAL was assigned a value of 2.

Clean this up properly, and define a proper enum for the notification
mode. Now we have:

- TWA_NONE. This is 0, same as before the original change, meaning no
  notification requested.
- TWA_RESUME. This is 1, same as before the original change, meaning
  that we use TIF_NOTIFY_RESUME.
- TWA_SIGNAL. This uses TIF_SIGPENDING/JOBCTL_TASK_WORK for the
  notification.

Clean up all the callers, switching their 0/1/false/true to using the
appropriate TWA_* mode for notifications.

Fixes: e91b4816 ("task_work: teach task_work_add() to do signal_wake_up()")
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3c532798
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1277,7 +1277,7 @@ static void queue_task_work(struct mce *m, int kill_it)
	else
		current->mce_kill_me.func = kill_me_maybe;

	task_work_add(current, &current->mce_kill_me, true);
	task_work_add(current, &current->mce_kill_me, TWA_RESUME);
}

/*
+1 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}
+1 −1
Original line number Diff line number Diff line
@@ -2229,7 +2229,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);
	}
+1 −1
Original line number Diff line number Diff line
@@ -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(),
Loading