Re: [PATCH 2/4] nohz: Synchronize sleep time stats with seqlock

From: Peter Zijlstra
Date: Wed Aug 21 2013 - 14:32:18 EST


On Wed, Aug 21, 2013 at 07:09:27PM +0200, Oleg Nesterov wrote:
> So, unlike me, you like -02 more than -Os ;)

I haven't checked the actual flags they enable in a while, but I think I
prefer something in the middle.

Esp. -freorder-blocks and the various -falign flags are something you
really want with -Os.

> > +static inline long schedule_timeout(long timeout)
> > +{
> > + if (timeout == MAX_SCHEDULE_TIMEOUT) {
> > + schedule();
> > + return timeout;
> > + }
> > + return __schedule_timeout(timeout);
> > +}
>
> Well this means that every caller will do the MAX_SCHEDULE_TIMEOUT
> check inline, and this case is unlikely.

OK, so do not remove the MAX_SCHEDULE_TIMEOUT check from
__schedule_timeout() and change the above to:

static __always_inline long schedule_timeout(long timeout)
{
if (__builtin_constant_p(timeout) && timeout == MAX_SCHEDULE_TIMEOUT) {
schedule();
return timeout;
}
return __schedule_timeout(timeout);
}

That should avoid extra code generation for the runtime sites while
still allowing what we set out to do.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/