Increasing value of sched_latency_ns and sched_min_granularity_ns

4

Why do I get an error message when I try to increase the values of these two parameters:

#cat /proc/sys/kernel/sched_latency_ns
1000000000
#echo 2000000000 > /proc/sys/kernel/sched_latency_ns
bash: echo: write error: Invalid argument
#

I get the same error when I replace sched_latency_ns by sched_min_granularity_ns.

Can someone tell me the correct way to increase these parameters.

Prasoon Tiwari

Posted 2012-12-26T13:25:37.400

Reputation: 141

Answers

3

One second is the absolute maximum accepted value for that setting. Values more than 1000000000 are not valid (the number of nanoseconds in one second).

See the kernel source code

262 static int max_sched_granularity_ns = NSEC_PER_SEC;     /* 1 second */

and

line 294

294         {
295                 .procname       = "sched_latency_ns",
296                 .data           = &sysctl_sched_latency,
297                 .maxlen         = sizeof(unsigned int),
298                 .mode           = 0644,
299                 .proc_handler   = sched_proc_update_handler,
300                 .extra1         = &min_sched_granularity_ns,
301                 .extra2         = &max_sched_granularity_ns,
302         },

Larger and larger values have a diminishing improvement on performance. Excessively high values can cause issues. One second is already an extremely high setting.

doug65536

Posted 2012-12-26T13:25:37.400

Reputation: 131