提交 4636c3a8 编写于 作者: P Pavel Begunkov 提交者: Cheng Jian

tasks: add put_task_struct_many()

mainline inclusion
from mainline-5.9-rc1
commit dd6f843a
category: feature
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27
CVE: NA
---------------------------

put_task_struct_many() is as put_task_struct() but puts several
references at once. Useful to batching it.
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>

Conflicts:
	include/linux/sched/task.h
[ec1d2819 ("sched/core: Convert task_struct.usage to refcount_t)"
not merge]
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 b28dcdc8
......@@ -98,6 +98,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 (atomic_sub_and_test(nr, &t->usage))
__put_task_struct(t);
}
struct task_struct *task_rcu_dereference(struct task_struct **ptask);
#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册