fix qos level shift in user and kernel

Signed-off-by: cee_mac <2710242656@qq.com>
This commit is contained in:
cee_mac
2023-11-23 16:38:44 +08:00
parent 8616182184
commit f4f2693d29
3 changed files with 4 additions and 10 deletions
+2 -5
View File
@@ -479,9 +479,6 @@ static long ctrl_qos_operation(int abi, void __user *uarg)
return ret;
}
/* transfer user space qos level to kernel space qos level */
qos_data.level -= QOS_LEVEL_INTERVAL;
return do_qos_manipulate(&qos_data);
}
@@ -541,7 +538,7 @@ static inline bool valid_qos_item(struct qos_policy_datas *datas)
}
/* check user space qos polcicy data, level 0 reserved */
for (i = 0; i <= NR_QOS; ++i) {
for (i = 0; i < NR_QOS; ++i) {
data = &datas->policys[i];
if (!valid_nice(data->nice)) {
@@ -593,7 +590,7 @@ static long do_qos_policy_change(struct qos_policy_datas *datas)
item = &qos_policy_array[type].levels[i];
/* user space policy params */
data = &datas->policys[i + QOS_LEVEL_INTERVAL];
data = &datas->policys[i];
item->nice = data->nice;
item->latency_nice = data->latency_nice;
+1 -4
View File
@@ -13,11 +13,8 @@
#include <linux/sched/qos_ctrl.h>
/* qos level interval between user space and kernel space */
#define QOS_LEVEL_INTERVAL 1
/* min qos level used in kernel space, begin index for LOOP */
#define QOS_POLICY_MIN_LEVEL (NO_QOS + QOS_LEVEL_INTERVAL)
#define QOS_POLICY_MIN_LEVEL 0
struct qos_policy_item {
int nice;
+1 -1
View File
@@ -104,7 +104,7 @@ struct qos_policy_datas {
*/
int policy_type;
unsigned int policy_flag;
struct qos_policy_data policys[NR_QOS + 1];
struct qos_policy_data policys[NR_QOS];
};
struct auth_struct;