]> git.baikalelectronics.ru Git - kernel.git/commit
task_work: teach task_work_add() to do signal_wake_up()
authorOleg Nesterov <oleg@redhat.com>
Tue, 30 Jun 2020 15:32:54 +0000 (17:32 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Jun 2020 18:18:08 +0000 (12:18 -0600)
commitb6f6100d2b8fc551fd89814aba592ad1a91c06c0
treec7cf68d7e37016bb5a7dc479d5396fee6f7bc776
parent62a8abdd9ec12954663470f7bb3672e096a42ef7
task_work: teach task_work_add() to do signal_wake_up()

So that the target task will exit the wait_event_interruptible-like
loop and call task_work_run() asap.

The patch turns "bool notify" into 0,TWA_RESUME,TWA_SIGNAL enum, the
new TWA_SIGNAL flag implies signal_wake_up().  However, it needs to
avoid the race with recalc_sigpending(), so the patch also adds the
new JOBCTL_TASK_WORK bit included in JOBCTL_PENDING_MASK.

TODO: once this patch is merged we need to change all current users
of task_work_add(notify = true) to use TWA_RESUME.

Cc: stable@vger.kernel.org # v5.7
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/sched/jobctl.h
include/linux/task_work.h
kernel/signal.c
kernel/task_work.c