Re: [PATCH v3 05/10] sched/fair: Hoist idle_stamp up from idle_balance

From: Valentin Schneider
Date: Tue Nov 20 2018 - 05:24:57 EST


On 19/11/2018 17:31, Steven Sistare wrote:
[...]
>>> +#define IF_SMP(statement) statement
>>> +
>>
>> I'm not too hot on those IF_SMP() macros. Since you're not introducing
>> any other user for them, what about an inline function for rq->idle_stamp
>> setting ? When it's mapped to an empty statement (!CONFIG_SMP) GCC is
>> smart enough to remove the rq_clock() that would be passed to it on
>> CONFIG_SMP:
>
> That may be true now, but I worry that rq_clock or its subroutines may gain
> side effects in the future that prevent the compiler from removing it. However,
> I could push rq_clock into the inline function:
>
> static inline void rq_idle_stamp_set(rq) { rq->idle_stamp = rq_clock(rq); }
> static inline void rq_idle_stamp_clear(rq) { rq->idle_stamp = 0; }
>
> I like that better, do you?
>

That works for me, though I can't resist nitpicking on
s/rq_idle_stamp_set/rq_idle_stamp_update/

> - Steve