From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754845AbYIKIa2 (ORCPT ); Thu, 11 Sep 2008 04:30:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752015AbYIKIaR (ORCPT ); Thu, 11 Sep 2008 04:30:17 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:48787 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752235AbYIKIaP (ORCPT ); Thu, 11 Sep 2008 04:30:15 -0400 Subject: Re: deadlock in setting schedule parameters From: Peter Zijlstra To: Hiroshi Shimamoto Cc: ronne@list.ru, mingo@elte.hu, rml@tech9.net, linux-kernel@vger.kernel.org In-Reply-To: <48C85F93.9020602@ct.jp.nec.com> References: <48C838F9.1050607@list.ru> <48C85F93.9020602@ct.jp.nec.com> Content-Type: text/plain Date: Thu, 11 Sep 2008 10:30:04 +0200 Message-Id: <1221121804.4415.1078.camel@twins.programming.kicks-ass.net> Mime-Version: 1.0 X-Mailer: Evolution 2.23.91 (2.23.91-1.fc10) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2008-09-10 at 17:00 -0700, Hiroshi Shimamoto wrote: > Andrei Gusev wrote: > > Hello! > > > > I played witch scheduler settings. After doing something like: > > echo -n 1000000 >sched_rt_period_us > > > > command is looked. I found in kernel.log > > Sep 11 00:39:34 zaratustra > > Sep 11 00:39:34 zaratustra Pid: 4495, comm: bash Tainted: G W > > (2.6.26.3 #12) > > Sep 11 00:39:34 zaratustra EIP: 0060:[] EFLAGS: 00210246 CPU: 0 > > Sep 11 00:39:34 zaratustra EIP is at div64_u64+0x57/0x80 > > Sep 11 00:39:34 zaratustra EAX: 0000389f EBX: 00000000 ECX: 00000000 > > EDX: 00000000 > > Sep 11 00:39:34 zaratustra ESI: d9800000 EDI: d9800000 EBP: 0000389f > > ESP: ea7a6edc > > Sep 11 00:39:34 zaratustra DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068 > > Sep 11 00:39:34 zaratustra Process bash (pid: 4495, ti=ea7a6000 > > task=ea744000 task.ti=ea7a6000) > > Sep 11 00:39:34 zaratustra Stack: 00000000 000003e8 d9800000 0000389f > > c0119042 00000000 00000000 00000001 > > Sep 11 00:39:34 zaratustra 00000000 00000000 ea7a6f54 00010000 00000000 > > c04d2e80 00000001 000e7ef0 > > Sep 11 00:39:34 zaratustra c01191a3 00000000 00000000 ea7a6fa0 00000001 > > ffffffff c04d2e80 ea5b2480 > > Sep 11 00:39:34 zaratustra Call Trace: > > Sep 11 00:39:34 zaratustra [] __rt_schedulable+0x52/0x130 > > Sep 11 00:39:34 zaratustra [] sched_rt_handler+0x83/0x120 > > Sep 11 00:39:34 zaratustra [] proc_sys_call_handler+0xb6/0xd0 > > Sep 11 00:39:34 zaratustra [] proc_sys_write+0x0/0x20 > > Sep 11 00:39:34 zaratustra [] proc_sys_write+0x19/0x20 > > Sep 11 00:39:34 zaratustra [] vfs_write+0xa8/0x140 > > Sep 11 00:39:34 zaratustra [] sys_write+0x41/0x80 > > Sep 11 00:39:34 zaratustra [] sysenter_past_esp+0x6a/0x91 > > Sep 11 00:39:34 zaratustra ======================= > > Sep 11 00:39:34 zaratustra Code: c8 41 0f ad f3 d3 ee f6 c1 20 0f 45 de > > 31 f6 0f ad ef d3 ed f6 c1 20 0f 45 fd 0f 45 ee 31 c9 39 eb 89 fe 89 ea > > 77 08 89 e8 31 d2 f3 89 c1 89 f0 8b 7c 24 08 f7 f3 8b 74 24 04 89 > > ca 8b 1c 24 > > Sep 11 00:39:34 zaratustra EIP: [] div64_u64+0x57/0x80 SS:ESP > > 0068:ea7a6edc > > Sep 11 00:39:34 zaratustra ---[ end trace 4eaa2a86a8e2da22 ]--- > > Hi, > > I'm not sure this patch really addresses the issue. > But the kernel locks after changing sysctl_sched_rt_period=0. > > This patch is against -tip. > I think it's needed to -stable too. > --------> > From: Hiroshi Shimamoto > Subject: [PATCH] sched: do not allow sysctl_sched_rt_period=0 > > sysctl_sched_rt_period=0 makes exception at to_ratio(). Right - runtime can be -1, 0, + but period ought to be >0, good spotting. Acked-by: Peter Zijlstra > Signed-off-by: Hiroshi Shimamoto > --- > kernel/sched.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/kernel/sched.c b/kernel/sched.c > index 8f4af55..32d56d6 100644 > --- a/kernel/sched.c > +++ b/kernel/sched.c > @@ -8971,6 +8971,9 @@ static int sched_rt_global_constraints(void) > u64 rt_runtime, rt_period; > int ret = 0; > > + if (sysctl_sched_rt_period <= 0) > + return -EINVAL; > + > rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period); > rt_runtime = tg->rt_bandwidth.rt_runtime; > > @@ -8988,6 +8991,9 @@ static int sched_rt_global_constraints(void) > unsigned long flags; > int i; > > + if (sysctl_sched_rt_period <= 0) > + return -EINVAL; > + > spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); > for_each_possible_cpu(i) { > struct rt_rq *rt_rq = &cpu_rq(i)->rt;