Re: [PATCH 08/14] hrtimer: Allow hrtimer::function() to free the timer

From: Thomas Gleixner
Date: Fri Jun 05 2015 - 05:48:41 EST


On Fri, 5 Jun 2015, Peter Zijlstra wrote:
> /*
> + * We require the migration_base for lock_hrtimer_base()/switch_hrtimer_base()
> + * such that hrtimer_callback_running() can unconditionally dereference
> + * timer->base->cpu_base
> + */
> +static struct hrtimer_cpu_base migration_cpu_base = {
> + .seq = SEQCNT_ZERO(migration_cpu_base),
> +};
> +
> +static struct hrtimer_clock_base migration_base = {
> + .cpu_base = &migration_cpu_base,
> +};

You can spare that extra migration clock base, because
migration_cpu_base already has clock bases inside.

static struct hrtimer_cpu_base migration_cpu_base = {
.seq = SEQCNT_ZERO(migration_cpu_base),
};

and do:

migration_cpu_base.clock_base[CLOCK_MONOTONIC].cpu_base = &migration_cpu_base;

in hrtimer_init.

So migration base becomes:

#define migration_base &migration_cpu_base.clock_base[CLOCK_MONOTONIC]

That's also more efficient in terms of cache because is two adjacent
cache lines instead of two distant ones.

Other than that, this looks good.

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/