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>
Sun, 4 Apr 2021 21:28:18 +0000 (15:28 -0600)
commit7fabeeac15873b5d968a0d243d766bd2b8199815
treee19baccfa5457de0c789cf9e1c78e3b257f06b53
parentf131a8470cbb18eef54257f3dc4e99ff502d26a7
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.

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