[PATCH 1/2] OProfile - Enable SPU switch notification to detect currently active SPU tasks - update

Arnd Bergmann ARNDB at de.ibm.com
Sat Jul 21 05:58:18 EST 2007


On Friday 20 July 2007, Andrew Morton wrote:
> +       for_each_online_node(node) {
>                 struct spu *spu;
>                 mutex_lock(&spu_prio->active_mutex[node]);
>                 list_for_each_entry(spu, &spu_prio->active_list[node], list) {
>                         struct spu_context *ctx = spu->ctx;
>                         set_bit(SPU_SCHED_NOTIFY_ACTIVE, &ctx->sched_flags);
> -                       mb();
> +                       mb();   /* make sure any tasks woken up below */
> +                               /* can see the bit(s) set above */
>                         wake_up_all(&ctx->stop_wq);
>                 }
>                 mutex_unlock(&spu_prio->active_mutex[node]);
> _
> 
> I still wonder about that barrier.  At the least it should be smp_mb(). 
> But aren't our set_bit() semantics _alone_ sufficient to make this barrier
> unneeded?

I believe they are sufficient on powerpc, and should be everywhere, so
the mb() can probably go away entirely. set_bit() does a ldarx/stdcx,
which is guaranteed to be atomic across CPUs.

	Arnd <><


More information about the Linuxppc-dev mailing list