proposed smp_rendezvous change
Max Laier
max at love2party.net
Wed May 18 20:27:56 UTC 2011
On 05/17/2011 01:35 PM, John Baldwin wrote:
...
> Yeah, I already have a patch to do that, but hadn't added atomic ops to
> critical_enter() and critical_exit(). But it also wasn't as fancy in the
> critical_exit() case. Here is what I have and I think it might actually
> be ok (it doesn't use an atomic read and clear, but I think it is safe).
> Hmm, actually, it will need to use the read and clear:
Looks good to me. I was slightly surprised by this:
> Index: kern/kern_synch.c
> ===================================================================
> --- kern/kern_synch.c (revision 222024)
> +++ kern/kern_synch.c (working copy)
> @@ -400,9 +400,7 @@
> if (!TD_ON_LOCK(td)&& !TD_IS_RUNNING(td))
> mtx_assert(&Giant, MA_NOTOWNED);
> #endif
> - KASSERT(td->td_critnest == 1 || (td->td_critnest == 2&&
> - (td->td_owepreempt)&& (flags& SW_INVOL) != 0&&
> - newtd == NULL) || panicstr,
> + KASSERT(td->td_critnest == 1 || panicstr,
> ("mi_switch: switch in a critical section"));
> KASSERT((flags& (SW_INVOL | SW_VOL)) != 0,
> ("mi_switch: switch must be voluntary or involuntary"));
part of the patch. But that is in fact correct and much more expressive
and safe than the version we had before.
Thanks,
Max
P.S. I'd like to see this and the rendezvous changes in stable/7 in the
not too distant future. Mind if I MFH these when you are done - unless
you are planing to do it already, anyways.
More information about the freebsd-current
mailing list