aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-07-18 11:32:51 +0300
committerJens Axboe <axboe@kernel.dk>2020-07-24 13:00:45 -0600
commitdd6f843a9fca8f225c86fee5f50da429c369c045 (patch)
treeb630dd42ef994b21606a17f0c9ecb18b5fed08d4 /include/linux/sched
parentio_uring: return locked and pinned page accounting (diff)
downloadlinux-dev-dd6f843a9fca8f225c86fee5f50da429c369c045.tar.xz
linux-dev-dd6f843a9fca8f225c86fee5f50da429c369c045.zip
tasks: add put_task_struct_many()
put_task_struct_many() is as put_task_struct() but puts several references at once. Useful to batching it. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/sched')
-rw-r--r--include/linux/sched/task.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h
index 38359071236a..1301077f9c24 100644
--- a/include/linux/sched/task.h
+++ b/include/linux/sched/task.h
@@ -126,6 +126,12 @@ static inline void put_task_struct(struct task_struct *t)
__put_task_struct(t);
}
+static inline void put_task_struct_many(struct task_struct *t, int nr)
+{
+ if (refcount_sub_and_test(nr, &t->usage))
+ __put_task_struct(t);
+}
+
void put_task_struct_rcu_user(struct task_struct *task);
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT