public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jason Low <jason.low2@hp.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Mike Galbraith <umgwanakikbuti@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Scott J Norton <scott.norton@hp.com>,
	Chegu Vinod <chegu_vinod@hp.com>,
	Aswin Chandramouleeswaran <aswin@hp.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] sched, timer: Use atomics for thread_group_cputimer stats
Date: Fri, 23 Jan 2015 21:11:03 +0100	[thread overview]
Message-ID: <20150123201103.GF23123@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1422036451.2436.10.camel@j-VirtualBox>

On Fri, Jan 23, 2015 at 10:07:31AM -0800, Jason Low wrote:
> On Fri, 2015-01-23 at 10:33 +0100, Peter Zijlstra wrote:
> > > +		.running = ATOMIC_INIT(0),                              \
> > > +	atomic_t running;
> > > +		atomic_set(&sig->cputimer.running, 1);
> > > @@ -174,7 +174,7 @@ static inline bool cputimer_running(struct task_struct *tsk)
> > > +	if (!atomic_read(&cputimer->running))
> > > +	if (!atomic_read(&cputimer->running)) {
> > > +		atomic_set(&cputimer->running, 1);
> > > +	if (atomic_read(&tsk->signal->cputimer.running))
> > > +	atomic_set(&cputimer->running, 0);
> > > +	if (atomic_read(&sig->cputimer.running)) {
> > > +	if (atomic_read(&tsk->signal->cputimer.running))
> > 
> > That doesn't really need an atomic_t.
> 
> Yeah, I was wondering about that, and made it atomic since we had:
> 
>     raw_spin_lock_irqsave(&cputimer->lock, flags);
>     cputimer->running = 0;
>     raw_spin_unlock_irqrestore(&cputimer->lock, flags);
> 
> in stop_process_timers().

Yeah, that could've been ACCESS_ONCE(cputimer->running) = 0. FWIW
atomic_set() seems to not actually include the needed volatile cast.

      reply	other threads:[~2015-01-23 20:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  3:31 [RFC PATCH] sched, timer: Use atomics for thread_group_cputimer stats Jason Low
2015-01-23  8:57 ` Peter Zijlstra
2015-01-23  9:25 ` Peter Zijlstra
2015-01-23 19:23   ` Jason Low
2015-01-23 20:08     ` Peter Zijlstra
2015-01-23 23:39       ` Jason Low
2015-01-23 23:45       ` Jason Low
2015-01-26 17:12         ` Peter Zijlstra
2015-01-23  9:33 ` Peter Zijlstra
2015-01-23 18:07   ` Jason Low
2015-01-23 20:11     ` Peter Zijlstra [this message]

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=20150123201103.GF23123@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=aswin@hp.com \
    --cc=chegu_vinod@hp.com \
    --cc=fweisbec@gmail.com \
    --cc=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=scott.norton@hp.com \
    --cc=umgwanakikbuti@gmail.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