Re: Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ]

From: Oleg Nesterov
Date: Mon Dec 12 2005 - 13:17:18 EST


Srivatsa Vaddagiri wrote:
>
> Oleg, with all these inputs, I consider the patch I had sent to be correct.

Yes, I think so. My suspects were due to my misunderstanding.
I was wrong when I said that we can ignore rmb() part of mb()
in case when start_hz_timer() runs after rcu_start_batch().

rcp->cur++;
// ->cur will be visible to other cpus
// _before_ we will *READ* nohz_cpu_mask.
// we don't have any 'timing' problems.
// In other words: if another cpu does not
// see the new value - we did not read this
// mask yet.
smp_mb();

Thanks for your patience.

> P.S :- Thanks to everybody who reponded clarifying this subject.

Yes! it was really helpful, thanks to all. I think it would be great
to have Paul's very clear (and short!) explanation somewhere in
Documentation/.

Oleg.
-
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/