提交 80cefd92 编写于 作者: Z Zhang Qiao 提交者: Zheng Zengkai

sched: Fix sleeping in atomic context at cpu_qos_write()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4WKMY
CVE: NA

--------------------------------

cfs_bandwidth_usage_inc() need hold jump_label_mutex and
might sleep, so we can not call it in atomic context.
Fix this by moving cfs_bandwidth_usage_{inc,dec}() out of
rcu read critical section.
Signed-off-by: NZhang Qiao <zhangqiao22@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b9c82a09
......@@ -8507,13 +8507,10 @@ static int tg_change_scheduler(struct task_group *tg, void *data)
struct cgroup_subsys_state *css = &tg->css;
tg->qos_level = qos_level;
if (qos_level == -1) {
if (qos_level == -1)
policy = SCHED_IDLE;
cfs_bandwidth_usage_inc();
} else {
else
policy = SCHED_NORMAL;
cfs_bandwidth_usage_dec();
}
param.sched_priority = 0;
css_task_iter_start(css, 0, &it);
......@@ -8541,6 +8538,13 @@ static int cpu_qos_write(struct cgroup_subsys_state *css,
if (tg->qos_level == -1 && qos_level == 0)
return -EINVAL;
cpus_read_lock();
if (qos_level == -1)
cfs_bandwidth_usage_inc();
else
cfs_bandwidth_usage_dec();
cpus_read_unlock();
rcu_read_lock();
walk_tg_tree_from(tg, tg_change_scheduler, tg_nop, (void *)(&qos_level));
rcu_read_unlock();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册