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.
Liao Chen (1): sched: migtate user interface from smart grid to sched bpf
fs/proc/base.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
From: chenridong chenridong@huawei.com
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 | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c index 47d331837499..62d79dba66bd 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3767,6 +3767,7 @@ static ssize_t pid_tag_write(struct file *file, const char __user *buf, struct inode *inode = file_inode(file); struct task_struct *tsk; int err = 0; + unsigned int level = SCHED_GRID_QOS_TASK_LEVEL_MAX; long tag = 0;
tsk = get_proc_task(inode); @@ -3784,6 +3785,16 @@ static ssize_t pid_tag_write(struct file *file, const char __user *buf,
sched_settag(tsk, tag);
+ 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; + + level = (unsigned int)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, level); + out: put_task_struct(tsk); return err < 0 ? err : count;
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/4502 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/6...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/4502 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/6...