From patchwork Wed Jun 16 20:42:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 106557 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5GKhjCt010207 for ; Wed, 16 Jun 2010 20:43:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932293Ab0FPUnX (ORCPT ); Wed, 16 Jun 2010 16:43:23 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:60708 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932155Ab0FPUnV (ORCPT ); Wed, 16 Jun 2010 16:43:21 -0400 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id o5GKgV09002895 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jun 2010 13:42:32 -0700 Received: from akpm.mtv.corp.google.com (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id o5GKgV1j026789; Wed, 16 Jun 2010 13:42:31 -0700 Date: Wed, 16 Jun 2010 13:42:31 -0700 From: Andrew Morton To: "Rafael J. Wysocki" Cc: sedat.dilek@gmail.com, Linux Kernel Mailing List , Maciej Rutecki , Linus Torvalds , Kernel Testers List , Network Development , Linux ACPI , Linux PM List , Linux SCSI List , Linux Wireless List , DRI , dmonakhov@openvz.org Subject: Re: 2.6.35-rc2-git2: Reported regressions from 2.6.34 Message-Id: <20100616134231.23ff30da.akpm@linux-foundation.org> In-Reply-To: <201006091122.35304.rjw@sisk.pl> References: <201006091122.35304.rjw@sisk.pl> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Spam-Status: No, hits=-2.996 required=5 tests=AWL,BAYES_00 X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 16 Jun 2010 20:43:46 +0000 (UTC) diff -puN drivers/cpuidle/governors/menu.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu drivers/cpuidle/governors/menu.c --- a/drivers/cpuidle/governors/menu.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu +++ a/drivers/cpuidle/governors/menu.c @@ -137,15 +137,18 @@ static inline int which_bucket(unsigned { int bucket = 0; + int cpu = get_cpu(); /* * We keep two groups of stats; one with no * IO pending, one without. * This allows us to calculate * E(duration)|iowait */ - if (nr_iowait_cpu()) + if (nr_iowait_cpu(cpu)) bucket = BUCKETS/2; + put_cpu(); + if (duration < 10) return bucket; if (duration < 100) @@ -169,13 +172,16 @@ static inline int which_bucket(unsigned static inline int performance_multiplier(void) { int mult = 1; + int cpu = get_cpu(); /* for higher loadavg, we are more reluctant */ mult += 2 * get_loadavg(); /* for IO wait tasks (per cpu!) we add 5x each */ - mult += 10 * nr_iowait_cpu(); + mult += 10 * nr_iowait_cpu(cpu); + + put_cpu(); return mult; } diff -puN include/linux/sched.h~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu include/linux/sched.h --- a/include/linux/sched.h~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu +++ a/include/linux/sched.h @@ -139,7 +139,7 @@ extern int nr_processes(void); extern unsigned long nr_running(void); extern unsigned long nr_uninterruptible(void); extern unsigned long nr_iowait(void); -extern unsigned long nr_iowait_cpu(void); +extern unsigned long nr_iowait_cpu(int cpu); extern unsigned long this_cpu_load(void); diff -puN kernel/sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu kernel/sched.c --- a/kernel/sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu +++ a/kernel/sched.c @@ -2864,9 +2864,9 @@ unsigned long nr_iowait(void) return sum; } -unsigned long nr_iowait_cpu(void) +unsigned long nr_iowait_cpu(int cpu) { - struct rq *this = this_rq(); + struct rq *this = cpu_rq(cpu); return atomic_read(&this->nr_iowait); } diff -puN kernel/time/tick-sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu kernel/time/tick-sched.c --- a/kernel/time/tick-sched.c~cpuidle-avoid-using-smp_processor_id-in-preemptible-code-nr_iowait_cpu +++ a/kernel/time/tick-sched.c @@ -159,10 +159,12 @@ update_ts_time_stats(struct tick_sched * ktime_t delta; if (ts->idle_active) { + int cpu = get_cpu(); delta = ktime_sub(now, ts->idle_entrytime); ts->idle_sleeptime = ktime_add(ts->idle_sleeptime, delta); - if (nr_iowait_cpu() > 0) + if (nr_iowait_cpu(cpu) > 0) ts->iowait_sleeptime = ktime_add(ts->iowait_sleeptime, delta); + put_cpu(); ts->idle_entrytime = now; }