From: Peter Zijlstra <peterz@infradead.org>
To: Ethan Zhao <ethan.zhao@oracle.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
james.puthukattukaran@oracle.com, ethan.kernel@gmail.com
Subject: Re: [PATCH] sched: reset sysctl_sched_time_avg to default when
Date: Fri, 1 Sep 2017 14:32:38 +0200 [thread overview]
Message-ID: <20170901123238.ruxqcvpbevelgwig@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1504265514-11759-1-git-send-email-ethan.zhao@oracle.com>
On Fri, Sep 01, 2017 at 07:31:54PM +0800, Ethan Zhao wrote:
> System will hang if user set sysctl_sched_time_avg to 0 by
>
> [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);
> ...
> }
>
> Seems this issue could be reproduced on all I tried stable 4.1 - last
> kernel.
>
> To fix this issue, reset sysctl_sched_time_avg to default value
> MSEC_PER_SEC if user input invalid value in function
>
> sched_avg_period()
>
> Reported-by: James Puthukattukaran <james.puthukattukaran@oracle.com>
> Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
> ---
> Tested on stable 4.1, compiled on stable 4.13-rc5
> kernel/sched/sched.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index eeef1a3..b398560 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1620,6 +1620,9 @@ static inline void rq_last_tick_reset(struct rq *rq)
>
> static inline u64 sched_avg_period(void)
> {
> + if (unlikely(sysctl_sched_time_avg <= 0))
> + sysctl_sched_time_avg = MSEC_PER_SEC;
> +
Sight, no.. you can set limits in the sysctl table.
next prev parent reply other threads:[~2017-09-01 12:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-01 11:31 Ethan Zhao
2017-09-01 12:32 ` Peter Zijlstra [this message]
2017-09-02 0:33 ` Ethan Zhao
2017-09-02 6:54 ` Ethan Zhao
2017-09-04 7:32 ` Peter Zijlstra
2017-09-04 7:43 ` Ethan Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170901123238.ruxqcvpbevelgwig@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ethan.kernel@gmail.com \
--cc=ethan.zhao@oracle.com \
--cc=james.puthukattukaran@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®