Yes, it would.
It would be a bit more overhead for taking the address than a
this_cpu_address(), because one would need to fetch the CPU number first
and do the arithmetic and the array reference instead of fetching the
address directly. But I agree that per_cpu() has much cleaner semantics than
this_cpu_address() for addresses, so it is worth it.
When one considers preemptive kernels where you can lose your CPU anytime
then it makes even more sense. But then this_cpu is only safe there when
you turn off preemption or hold some lock or run in interrupt context.
Outside such regions per_cpu() seems to be safer.
Thanks,
-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/