Skip to content

Commit dd6f843

Browse files
isilenceaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent cbcf721 commit dd6f843

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/linux/sched/task.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ static inline void put_task_struct(struct task_struct *t)
126126
__put_task_struct(t);
127127
}
128128

129+
static inline void put_task_struct_many(struct task_struct *t, int nr)
130+
{
131+
if (refcount_sub_and_test(nr, &t->usage))
132+
__put_task_struct(t);
133+
}
134+
129135
void put_task_struct_rcu_user(struct task_struct *task);
130136

131137
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT

0 commit comments

Comments
 (0)