lkml.org 
[lkml]   [2015]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] sched, timer: Use atomics for thread_group_cputimer stats
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.


\
 
 \ /
  Last update: 2015-01-23 21:21    [W:0.077 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site