task_work: add helper for more targeted task_work canceling
authorJens Axboe <axboe@kernel.dk>
Fri, 2 Apr 2021 01:53:29 +0000 (19:53 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Apr 2021 01:30:25 +0000 (19:30 -0600)
commitc7aab1a7c52b82d9afd7e03c398eb03dc2aa0507
tree5747e9fde43bf6665d6a82d1f29640a4b966d676
parentb2e720ace221f9be75fefdba7d0ebab9d05fc561
task_work: add helper for more targeted task_work canceling

The only exported helper we have right now is task_work_cancel(), which
cancels any task_work from a given task where func matches the queued
work item. This is a bit too coarse for some use cases. Add a
task_work_cancel_match() that allows to more specifically target
individual work items outside of purely the callback function used.

task_work_cancel() can be trivially implemented on top of that, hence do
so.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/task_work.h
kernel/task_work.c