task_work: allow TWA_SIGNAL without a rescheduling IPI
authorJens Axboe <axboe@kernel.dk>
Thu, 21 Apr 2022 23:34:35 +0000 (17:34 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 Apr 2022 23:19:02 +0000 (17:19 -0600)
commit64bc24ac03095d76b1678ef6d206a35e8581c376
tree31b049ce304d5bfd3db8707952c008519ca21978
parent1374e08e2d44863c931910797852589803997668
task_work: allow TWA_SIGNAL without a rescheduling IPI

Some use cases don't always need an IPI when sending a TWA_SIGNAL
notification. Add TWA_SIGNAL_NO_IPI, which is just like TWA_SIGNAL, except
it doesn't send an IPI to the target task. It merely sets
TIF_NOTIFY_SIGNAL and wakes up the task.

This can be useful in avoiding a forceful transition to the kernel if the
task is running in userspace. Depending on the task_work in question, it
may be quite fine waiting for the next reschedule or kernel enter anyway,
or the use case may even have other mechanisms for hinting to the task
that a transition may be useful. This can drive more cooperative
scheduling of task_work.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/sched/signal.h
include/linux/task_work.h
kernel/task_work.c