Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753992Ab0FNOGQ (ORCPT ); Mon, 14 Jun 2010 10:06:16 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:33564 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752719Ab0FNOGP (ORCPT ); Mon, 14 Jun 2010 10:06:15 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=WokiNOlWSV3LnqEDtJ/VslCH/UFiCdQGSJXmZ3kYsxyolekV6OhwsYDaAeiOSrkcTS NZWp48zw+EikCnD8oI4KAYgWqoll43tRLaWj74mzMH4zpEEx6QNE1ZuHhTbY/GAJsl1a +G/el4bcnCB7JDvIDbW7/NZcYzdsR5cPdSFXg= Date: Mon, 14 Jun 2010 17:09:41 +0300 From: Sergey Senozhatsky To: "Rafael J. Wysocki" Cc: Maxim Levitsky , Len Brown , Pavel Machek , Jiri Slaby , Andrew Morton , linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: BUG: using smp_processor_id() in preemptible code: s2disk Message-ID: <20100614140941.GA3581@swordfish.minsk.epam.com> References: <20100613203352.GA3577@swordfish> <1276461183.2659.4.camel@maxim-laptop> <201006140136.18652.rjw@sisk.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201006140136.18652.rjw@sisk.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 669 Lines: 26 Hello, Not sure if this simple solution is the correct one. --- diff --git a/kernel/sched.c b/kernel/sched.c index f8b8996..cfb262b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -2866,7 +2866,10 @@ unsigned long nr_iowait(void) unsigned long nr_iowait_cpu(void) { - struct rq *this = this_rq(); + int cpu = get_cpu(); + struct rq *this = cpu_rq(cpu); + put_cpu(); + return atomic_read(&this->nr_iowait); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/