Re: [PATCH tip/sched/core v2] sched/rt: Simplify the IPI rt balancing logic

From: Steven Rostedt
Date: Thu May 04 2017 - 11:05:39 EST


On Thu, 4 May 2017 16:41:28 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Mon, Apr 24, 2017 at 11:47:32AM -0400, Steven Rostedt wrote:
> > + /* Keep the loop going if the IPI is currently active */
> > + atomic_inc_return(&rq->rd->rto_loop_next);
>
> What's the return for?

-ENOCONTEXT (too much cut from email)

/me goes and finds his email that he sent.

/* Keep the loop going if the IPI is currently active */
atomic_inc_return(&rq->rd->rto_loop_next);

/* Only one CPU can initiate a loop at a time */
if (!rto_start_trylock(&rq->rd->rto_loop_start))
return;

Ah, it's not needed. I think I had that to supply a full memory
barrier for a previous version, but now that rto_start_trylock() is:

static inline bool rto_start_trylock(atomic_t *v)
{
return !atomic_cmpxchg(v, 0, 1);
}

Which supplies its own memory barrier, it can now be a simple

atomic_inc().

Thanks, will update.

-- Steve