Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755384AbbBTUCc (ORCPT ); Fri, 20 Feb 2015 15:02:32 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:33260 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753921AbbBTUCa (ORCPT ); Fri, 20 Feb 2015 15:02:30 -0500 Date: Fri, 20 Feb 2015 21:02:26 +0100 From: Peter Zijlstra To: Eric Dumazet Cc: Sergei Shtylyov , Fabian Frederick , linux-kernel@vger.kernel.org, Ingo Molnar , Greg Kroah-Hartman , "Jan \"Yenya\" Kasprzak" , netdev@vger.kernel.org Subject: Re: [PATCH 6/7 linux-next] wan: cosa: replace current->state by set_current_state() Message-ID: <20150220200226.GD23367@worktop.ger.corp.intel.com> References: <1424455977-21903-1-git-send-email-fabf@skynet.be> <1424455977-21903-6-git-send-email-fabf@skynet.be> <54E77E34.6050909@cogentembedded.com> <20150220185800.GR2896@worktop.programming.kicks-ass.net> <1424460713.5565.28.camel@edumazet-glaptop2.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1424460713.5565.28.camel@edumazet-glaptop2.roam.corp.google.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1367 Lines: 35 On Fri, Feb 20, 2015 at 11:31:53AM -0800, Eric Dumazet wrote: > On Fri, 2015-02-20 at 19:58 +0100, Peter Zijlstra wrote: > Maybe this might be self documented in set_current_state(), > as we have about 120 calls to __set_current_state(TASK_RUNNING) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 41c60e5302d7..26133da6445e 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -275,7 +275,11 @@ extern char ___assert_task_state[1 - 2*!!( > #define set_current_state(state_value) \ > do { \ > current->task_state_change = _THIS_IP_; \ > - set_mb(current->state, (state_value)); \ > + if (__builtin_constant_p(state_value) && \ > + (state_value) == TASK_RUNNING) \ > + current->state = (state_value); \ > + else \ > + set_mb(current->state, (state_value)); \ > } while (0) lkml.kernel.org/r/20150206163947.GR21418@twins.programming.kicks-ass.net The problem is that there _might_ be someone relying on that barrier. Its (very) unlikely, but you don't want to risk subtle borkage just because. And I'm too lazy to go audit all of them :/ -- 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/