Re: [PATCH] hrtimer: Replace cpu_base->active_bases with a direct check of the active list

From: Thomas Gleixner
Date: Thu Apr 09 2015 - 05:51:50 EST


On Thu, 9 Apr 2015, Ingo Molnar wrote:
> Btw., does cpu_base->active_bases even make sense? hrtimer bases are
> fundamentally percpu, and to check whether there are any pending
> timers is a very simple check:
>
> base->active->next != NULL
>
> So I'd rather suggest taking a direct look at the head, instead of
> calculating bit positions, masks, etc.
>
> Furthermore, we never actually use cpu_base->active_bases as a
> 'summary' value (which is the main point of bitmasks in general), so
> I'd remove that complication altogether.
>
> This would speed up various hrtimer primitives like
> hrtimer_remove()/add and simplify the code. It would be a net code
> shrink as well.

Well. You trade a bit more code against touching cache lines to figure
out whether the clock base has active timers or not. So for a lot of
scenarios where only clock monotonic is used you touch 3 cache lines
for nothing.

I'm about to send out a patch which actually makes better use of the
active_bases field without creating a code size explosion.

Thanks,

tglx
--
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/