Re: [PATCH 5/6] net: __this_cpu_inc in route.c

From: Peter Zijlstra
Date: Wed Oct 16 2013 - 04:47:18 EST


On Tue, Oct 15, 2013 at 12:47:27PM -0500, Christoph Lameter wrote:
> The RT_CACHE_STAT_INC macro triggers the new preemption checks
> for __this_cpu ops
>
> I do not see any other synchronization that would allow the use
> of a __this_cpu operation here however in commit
> dbd2915ce87e811165da0717f8e159276ebb803e Andrew justifies
> the use of raw_smp_processor_id() here because "we do not care"
> about races.
>
> So lets use raw_cpu ops here and hope for the best. The use of
> __this_cpu op improves the situation already from what commit
> dbd2915ce87e811165da0717f8e159276ebb803e did since the single instruction
> emitted on x86 does not allow the race to occur anymore. However,
> non x86 platforms could still experience a race here.
>

Are we sure all !x86 implementations will DTRT in that it will increment
some CPU and not get horribly confused? I suppose it would; but is
that a guarantee given someplace?
--
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/