Skip to contentSkip to conversation

sched/deadline: Use proc_douintvec_minmax() limit minimum value

PATCH Superseded Yajun Deng 2 participants 5 messages May 13, 2022 – Jun 7, 2022 Scheduler

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yajun Deng

author
#0 lore raw

PATCH 1/1 sched/deadline: Use proc_douintvec_minmax() limit minimum value

proc_dointvec() is not applicable for unsigned integer, use proc_douintvec_minmax() limit minimum value.

---
 kernel/sched/deadline.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/deadline.c +4 -2
index 85cd62e0dddd..4d2a780c6f73 100644
@@ -30,14 +30,16 @@ static struct ctl_table sched_dl_sysctls[] = {
 		.data           = &sysctl_sched_dl_period_max,
 		.maxlen         = sizeof(unsigned int),
 		.mode           = 0644,
-		.proc_handler   = proc_dointvec,
+		.proc_handler   = proc_douintvec_minmax,
+		.extra1         = (void *)&sysctl_sched_dl_period_min,
 	},
 	{
 		.procname       = "sched_deadline_period_min_us",
 		.data           = &sysctl_sched_dl_period_min,
 		.maxlen         = sizeof(unsigned int),
 		.mode           = 0644,
-		.proc_handler   = proc_dointvec,
+		.proc_handler   = proc_douintvec_minmax,
+		.extra2         = (void *)&sysctl_sched_dl_period_max,
 	},
 	{}
 };
Signature · 1 line
2.25.1
author
#1 lore raw

Ping.

Quoted 33 lines · Yajun Deng

proc_dointvec() is not applicable for unsigned integer, use proc_douintvec_minmax() limit minimum value.

---
kernel/sched/deadline.c | 6 ++++--

1 file changed, 4 insertions(+), 2 deletions(-)
kernel/sched/deadline.c +4 -2
index 85cd62e0dddd..4d2a780c6f73 100644
@@ -30,14 +30,16 @@ static struct ctl_table sched_dl_sysctls[] = {
 .data = &sysctl_sched_dl_period_max,
 .maxlen = sizeof(unsigned int),
 .mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = proc_douintvec_minmax,
+ .extra1 = (void *)&sysctl_sched_dl_period_min,
 },
 {
 .procname = "sched_deadline_period_min_us",
 .data = &sysctl_sched_dl_period_min,
 .maxlen = sizeof(unsigned int),
 .mode = 0644,
- .proc_handler = proc_dointvec,
+ .proc_handler = proc_douintvec_minmax,
+ .extra2 = (void *)&sysctl_sched_dl_period_max,
 },
 {}
 };
Signature · 1 line
2.25.1
#2 lore raw
In reply to Yajun Deng

Hi Yajun

Quoted 2 lines · Yajun Deng

proc_dointvec() is not applicable for unsigned integer, use proc_douintvec_minmax() limit minimum value.

I understand your patch, but your log message is somehow incomplete.

Could you expand on that, showing the problem using an example, and then how you see it fixed?

Also, could you please add the Fixes: tag so this patch can land on stable trees?

-- Daniel

author
#3 lore raw
Quoted 4 lines · Daniel Bristot de Oliveira

Hi Yajun

On 5/13/22 04:41, Yajun Deng wrote:

Quoted 8 lines
Quoted 2 lines

proc_dointvec() is not applicable for unsigned integer, use proc_douintvec_minmax() limit minimum value.

I understand your patch, but your log message is somehow incomplete.

Could you expand on that, showing the problem using an example, and then how you see it fixed?

This patch isn't a fix. It's just an optimization for match data and proc_handler in struct ctl_table.

Quoted 2 lines

Also, could you please add the Fixes: tag so this patch can land on stable trees?

This statement 'if (period < min || period > max)' in __checkparam_dl() will work fine even if there hasn't this patch. So this patch may not need land on stable trees.

Quoted 1 line

-- Daniel

#4 lore raw
Quoted 13 lines · Yajun Deng
Quoted 11 lines · Daniel Bristot de Oliveira

Hi Yajun

Quoted 2 lines · Yajun Deng

proc_dointvec() is not applicable for unsigned integer, use proc_douintvec_minmax() limit minimum value.

I understand your patch, but your log message is somehow incomplete.

Could you expand on that, showing the problem using an example, and then how you see it fixed?

Quoted 7 lines

This patch isn't a fix. It's just an optimization for match data and proc_handler in struct ctl_table.

Quoted 2 lines

Also, could you please add the Fixes: tag so this patch can land on stable trees?

This statement 'if (period < min || period > max)' in __checkparam_dl() will work fine even if there hasn't this patch. So this patch may not need land on stable trees.

Good, so you already know how to improve your log message.

-- Daniel