lkml.org 
[lkml]   [2015]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] timer: Reduce unnecessary sighand lock contention
On Thu, Aug 27, 2015 at 01:29:50PM -0700, Jason Low wrote:
> On Thu, 2015-08-27 at 14:53 +0200, Frederic Weisbecker wrote:
> > Sure, like:
> >
> > #define CPUTIMER_RUNNING 0x1
> > #define CPUTIMER_CHECKING 0x2
> >
> > struct thread_group_cputimer {
> > struct task_cputime_atomic cputime_atomic;
> > int status;
> > }
> >
> > So from cputimer_running() you just need to check:
> >
> > if (cputimer->status & CPUTIMER_RUNNING)
> >
> > And from run_posix_cpu_timer() fast-path:
> >
> > if (cputimer->status == CPUTIMER_RUNNING)
> >
> > so that ignores CPUTIMER_CHECKING case.
>
> Right, having just 1 "status" field can simply things a bit. The
> (cputimer->status == CPUTIMER_RUNNING) check does appear misleading
> though, since we're technically not only checking for if the "cputimer
> is running".
>
> Maybe something like:
>
> int status = cputimer->status;
> if ((status & CPUTIMER_RUNNING) && !(status & CPUTIMER_CHECKING))
>
> makes it more obvious what's going on here.

The result is the same but it may clarify the code indeed.

Thanks.


\
 
 \ /
  Last update: 2015-08-27 23:41    [W:0.236 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site