mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
	mingo@redhat.com, fweisbec@gmail.com
Subject: Re: [PATCH] sched/core: fix formatting issues in sched_can_stop_tick()
Date: Mon, 14 Apr 2014 20:38:38 +0200	[thread overview]
Message-ID: <20140414183838.GF11182@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <6c3484ccb8220d0c58db1cbd9c929fc8d83005fd.1397492119.git.viresh.kumar@linaro.org>

On Mon, Apr 14, 2014 at 09:47:41PM +0530, Viresh Kumar wrote:
> sched_can_stop_tick() was using 7 spaces instead of 8 spaces or a 'tab' at the
> beginning of each line. Which doesn't align with the Coding Guidelines.
> 
> Also it removes the *rq variable as it was used at only one place and hence we
> can directly use this_rq() instead.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> I don't think rq = tihs_rq() has to be done before smp_mb(), in case yes sorry
> for this patch :(
> 
>  kernel/sched/core.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 268a45e..13299c5 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -666,18 +666,14 @@ static inline bool got_nohz_idle_kick(void)
>  #ifdef CONFIG_NO_HZ_FULL
>  bool sched_can_stop_tick(void)
>  {
> +	/* Make sure rq->nr_running update is visible after the IPI */
> +	smp_rmb();
>  
> +	/* More than one running task need preemption */
> +	if (this_rq()->nr_running > 1)
> +		return false;
>  
> +	return true;
>  }
>  #endif /* CONFIG_NO_HZ_FULL */

AFAICT the smp_rmb() is entirely spurious, arch interrupts should ensure
consistency on their own. That is:

  CPU 0		  CPU 1

[w] X = 1
    IPI 1	    <int>
		[r] r = X

Should act as if there was a full memory barrier, making it so that the
read on CPU1 observes the write on CPU0.

  reply	other threads:[~2014-04-14 18:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 16:17 Viresh Kumar
2014-04-14 18:38 ` Peter Zijlstra [this message]
2014-04-14 22:48   ` Frederic Weisbecker
2014-04-15  3:59     ` Viresh Kumar

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=20140414183838.GF11182@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=fweisbec@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=viresh.kumar@linaro.org \
    /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

all inboxes | Powered by JetHome®