netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	Fabian Frederick <fabf@skynet.be>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Jan \"Yenya\" Kasprzak" <kas@fi.muni.cz>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 6/7 linux-next] wan: cosa: replace current->state by set_current_state()
Date: Fri, 20 Feb 2015 21:02:26 +0100	[thread overview]
Message-ID: <20150220200226.GD23367@worktop.ger.corp.intel.com> (raw)
In-Reply-To: <1424460713.5565.28.camel@edumazet-glaptop2.roam.corp.google.com>

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 :/

  parent reply	other threads:[~2015-02-20 20:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1424455977-21903-1-git-send-email-fabf@skynet.be>
2015-02-20 18:12 ` [PATCH 2/7 linux-next] mISDN: replace current->state by set_current_state() Fabian Frederick
2015-02-22 20:24   ` David Miller
2015-02-20 18:12 ` [PATCH 5/7 linux-next] hso: replace current->state by __set_current_state() Fabian Frederick
2015-02-22 20:25   ` David Miller
2015-02-20 18:12 ` [PATCH 6/7 linux-next] wan: cosa: replace current->state by set_current_state() Fabian Frederick
2015-02-20 18:26   ` Jan Yenya Kasprzak
2015-02-20 18:34   ` Sergei Shtylyov
2015-02-20 18:51     ` Fabian Frederick
2015-02-20 19:15       ` Sergei Shtylyov
2015-02-20 18:58     ` Peter Zijlstra
2015-02-20 19:31       ` Eric Dumazet
2015-02-20 19:44         ` Eric Dumazet
2015-02-20 20:02         ` Peter Zijlstra [this message]
2015-02-21  7:42       ` Fabian Frederick
2015-02-22 20:25   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150220200226.GD23367@worktop.ger.corp.intel.com \
    --to=peterz@infradead.org \
    --cc=eric.dumazet@gmail.com \
    --cc=fabf@skynet.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=kas@fi.muni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).