hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I918W0
--------------------------------
Migtating user interface from smart grid to sched bpf, which allows users to set SCHED_GRID_QOS_TASK_LEVEL through:
/proc/${pid}/task/${pid}/tag
interface. Although arbitrary integer value could be assigned to <tag>, currnetly we clamp the value of SCHED_GRID_QOS_TASK_LEVEL to 0-7, which maintains consistency.
Signed-off-by: Liao Chen liaochen4@huawei.com --- fs/proc/base.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1516ff281c70..f677731e8748 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3966,6 +3966,18 @@ static ssize_t pid_tag_write(struct file *file, const char __user *buf,
sched_settag(tsk, tag);
+#ifdef CONFIG_QOS_SCHED_SMART_GRID + tag = tag < SCHED_GRID_QOS_TASK_LEVEL_HIGHEST ? + SCHED_GRID_QOS_TASK_LEVEL_HIGHEST : tag; + tag = tag >= SCHED_GRID_QOS_TASK_LEVEL_MAX ? + SCHED_GRID_QOS_TASK_LEVEL_DEFAULT : tag; + + if (tsk->grid_qos != NULL && + tsk->grid_qos->stat.set_class_lvl != NULL) + err = tsk->grid_qos->stat.set_class_lvl(&tsk->grid_qos->stat, + (unsigned int)tag); +#endif + out: put_task_struct(tsk); return err < 0 ? err : count;