Ethan Zhao
5ccba44ba1
sched/sysctl: Check user input value of sysctl_sched_time_avg
...
System will hang if user set sysctl_sched_time_avg to 0:
[root@XXX ~]# sysctl kernel.sched_time_avg_ms=0
Stack traceback for pid 0
0xffff883f6406c600 0 0 1 3 R 0xffff883f6406cf50 *swapper/3
ffff883f7ccc3ae8 0000000000000018 ffffffff810c4dd0 0000000000000000
0000000000017800 ffff883f7ccc3d78 0000000000000003 ffff883f7ccc3bf8
ffffffff810c4fc9 ffff883f7ccc3c08 00000000810c5043 ffff883f7ccc3c08
Call Trace:
<IRQ> [<ffffffff810c4dd0>] ? update_group_capacity+0x110/0x200
[<ffffffff810c4fc9>] ? update_sd_lb_stats+0x109/0x600
[<ffffffff810c5507>] ? find_busiest_group+0x47/0x530
[<ffffffff810c5b84>] ? load_balance+0x194/0x900
[<ffffffff810ad5ca>] ? update_rq_clock.part.83+0x1a/0xe0
[<ffffffff810c6d42>] ? rebalance_domains+0x152/0x290
[<ffffffff810c6f5c>] ? run_rebalance_domains+0xdc/0x1d0
[<ffffffff8108a75b>] ? __do_softirq+0xfb/0x320
[<ffffffff8108ac85>] ? irq_exit+0x125/0x130
[<ffffffff810b3a17>] ? scheduler_ipi+0x97/0x160
[<ffffffff81052709>] ? smp_reschedule_interrupt+0x29/0x30
[<ffffffff8173a1be>] ? reschedule_interrupt+0x6e/0x80
<EOI> [<ffffffff815bc83c>] ? cpuidle_enter_state+0xcc/0x230
[<ffffffff815bc80c>] ? cpuidle_enter_state+0x9c/0x230
[<ffffffff815bc9d7>] ? cpuidle_enter+0x17/0x20
[<ffffffff810cd6dc>] ? cpu_startup_entry+0x38c/0x420
[<ffffffff81053373>] ? start_secondary+0x173/0x1e0
Because divide-by-zero error happens in function:
update_group_capacity()
update_cpu_capacity()
scale_rt_capacity()
{
...
total = sched_avg_period() + delta;
used = div_u64(avg, total);
...
}
To fix this issue, check user input value of sysctl_sched_time_avg, keep
it unchanged when hitting invalid input, and set the minimum limit of
sysctl_sched_time_avg to 1 ms.
Reported-by: James Puthukattukaran <james.puthukattukaran@oracle.com>
Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: efault@gmx.de
Cc: ethan.kernel@gmail.com
Cc: keescook@chromium.org
Cc: mcgrof@kernel.org
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/1504504774-18253-1-git-send-email-ethan.zhao@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-09-29 13:20:13 +02:00
..
2017-09-19 16:38:53 -07:00
2017-09-12 11:30:56 -07:00
2017-08-22 18:43:23 -07:00
2017-03-02 08:42:34 +01:00
2017-09-20 14:10:29 -07:00
2017-05-12 15:57:15 -07:00
2017-09-16 20:20:56 +02:00
2017-06-20 10:42:19 +02:00
2017-09-13 18:53:16 -07:00
2017-09-12 11:30:56 -07:00
2017-09-07 21:00:52 -07:00
2017-09-25 15:22:31 -07:00
2017-09-29 11:02:57 +02:00
2017-09-08 18:26:51 -07:00
2017-09-29 11:02:45 +02:00
2017-09-04 19:05:15 -04:00
2017-05-23 10:01:37 +02:00
2017-05-03 11:05:15 -07:00
2017-05-03 11:05:15 -07:00
2017-08-16 16:48:34 -07:00
2017-09-05 09:46:59 -04:00
2017-09-03 20:21:24 -04:00
2017-05-02 10:16:05 -04:00
2017-09-14 17:37:26 -07:00
2017-01-12 07:01:56 -07:00
2017-07-15 20:46:47 -04:00
2016-12-24 11:46:01 -08:00
2017-07-31 13:09:49 +02:00
2017-09-04 13:53:53 -07:00
2017-07-12 16:26:00 -07:00
2017-05-18 10:30:19 -06:00
2017-03-02 08:42:39 +01:00
2017-09-11 18:34:47 -07:00
2017-09-23 16:50:20 -04:00
2017-09-12 13:21:00 -07:00
2016-12-24 11:46:01 -08:00
2017-08-25 22:49:59 +02:00
2017-07-10 16:32:34 -07:00
2017-05-08 17:15:10 -07:00
2017-08-10 12:28:59 +02:00
2017-07-10 16:32:34 -07:00
2017-07-12 16:26:01 -07:00
2017-09-08 18:26:51 -07:00
2017-07-18 11:38:04 +02:00
2017-07-12 16:26:02 -07:00
2017-07-12 16:26:02 -07:00
2017-07-12 16:26:00 -07:00
2017-09-08 18:26:51 -07:00
2017-07-08 11:05:35 +02:00
2017-07-12 16:25:59 -07:00
2017-08-31 16:33:15 -07:00
2017-03-02 08:42:39 +01:00
2017-09-08 18:26:51 -07:00
2017-09-08 18:26:46 -07:00
2017-07-25 15:08:32 +02:00
2017-02-24 17:46:56 -08:00
2017-03-13 15:57:41 -03:00
2017-05-26 10:10:37 +02:00
2017-08-17 10:40:26 +02:00
2017-04-18 10:37:13 +02:00
2017-07-20 07:43:58 -05:00
2017-08-21 12:47:31 -07:00
2017-03-02 08:42:39 +01:00
2017-07-24 14:30:28 -05:00
2017-05-02 11:38:06 -07:00
2017-09-27 22:51:12 -07:00
2017-09-11 18:34:47 -07:00
2017-09-08 18:26:48 -07:00
2017-03-02 08:42:35 +01:00
2017-04-11 09:06:32 +02:00
2017-03-08 09:18:02 +01:00
2017-05-26 10:10:36 +02:00
2016-12-22 22:58:37 -05:00
2017-07-20 07:46:07 -05:00
2017-09-04 19:05:15 -04:00
2017-09-29 13:20:13 +02:00
2017-07-25 10:08:58 -07:00
2017-05-08 17:15:12 -07:00
2017-07-25 13:04:45 -07:00
2017-03-02 08:42:35 +01:00
2017-03-02 08:42:39 +01:00
2017-03-06 15:26:37 -06:00
2017-03-02 08:42:31 +01:00
2017-09-08 18:26:50 -07:00
2017-08-29 15:14:38 +02:00
2017-07-20 07:43:58 -05:00
2017-03-02 08:42:29 +01:00
2017-03-03 01:45:36 +01:00
2017-03-02 08:42:38 +01:00
2017-08-18 12:35:02 +02:00
2017-08-18 12:35:02 +02:00
2017-09-06 21:59:31 -07:00