From patchwork Tue Jan 18 15:34:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 79322 X-Patchwork-Delegate: stefan.bader@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id C59C2B70F1 for ; Wed, 19 Jan 2011 02:34:40 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1PfDZl-0007Rj-Lx; Tue, 18 Jan 2011 15:34:29 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1PfDZk-0007RU-GO for kernel-team@lists.ubuntu.com; Tue, 18 Jan 2011 15:34:28 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1PfDZj-0008Th-RX for ; Tue, 18 Jan 2011 15:34:27 +0000 Received: from p5b2e57a5.dip.t-dialin.net ([91.46.87.165] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1PfDZj-0007jy-MZ for kernel-team@lists.ubuntu.com; Tue, 18 Jan 2011 15:34:27 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2] sched: Try tp catch cpu_power being set to 0 Date: Tue, 18 Jan 2011 16:34:23 +0100 Message-Id: <1295364863-9028-3-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1295364863-9028-1-git-send-email-stefan.bader@canonical.com> References: <1295364863-9028-1-git-send-email-stefan.bader@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This is an optional change to try catching the culprit which changes cpu_power to 0 (should never happen) and causes divide by zero crashes later on in the scheduler code. BugLink: http://bugs.launchpad.net/bugs/614853 Signed-off-by: Stefan Bader Acked-by: Andy Whitcroft Acked-by: Tim Gardner --- kernel/sched.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/kernel/sched.c b/kernel/sched.c index d4a4b14..7ef70c0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3713,6 +3713,7 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) unsigned long weight = sd->span_weight; unsigned long power = SCHED_LOAD_SCALE; struct sched_group *sdg = sd->groups; + unsigned long scale_rt; if (sched_feat(ARCH_POWER)) power *= arch_scale_freq_power(sd, cpu); @@ -3730,12 +3731,18 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) power >>= SCHED_LOAD_SHIFT; } - power *= scale_rt_power(cpu); + scale_rt = scale_rt_power(cpu); + power *= scale_rt; + power >>= SCHED_LOAD_SHIFT; if (!power) power = 1; + if (WARN_ON((long) power <= 0)) + printk(KERN_ERR "cpu_power = %ld; scale_rt = %ld\n", + power, scale_rt); + sdg->cpu_power = power; } @@ -3759,6 +3766,9 @@ static void update_group_power(struct sched_domain *sd, int cpu) } while (group != child->groups); sdg->cpu_power = power; + + if (WARN_ON((long) power <= 0)) + printk(KERN_ERR "cpu_power = %ld\n", power); } /**