]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jan 2023 10:39:23 +0000 (11:39 +0100)
commited3005032993da7a3fe2e6095436e0bc2e83d011
treeea9da94dac96fbab4b162c949ca22eb7664a3f1d
parent831cb78a2a5e86fe705ef4e3095c7cbc587c6a57
task_work: add helper for more targeted task_work canceling

[ Upstream commit c7aab1a7c52b82d9afd7e03c398eb03dc2aa0507 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/task_work.h
kernel/task_work.c