PERFORCE change 68252 for review
John Baldwin
jhb at FreeBSD.org
Wed Jan 5 22:50:28 GMT 2005
On Tuesday 04 January 2005 08:14 am, David Xu wrote:
> http://perforce.freebsd.org/chv.cgi?CH=68252
>
> Change 68252 by davidxu at davidxu_tiger on 2005/01/04 13:14:06
>
> insert "pause" instructor for i386.
> style fix.
You can use 'cpu_spinwait()' for this to be MI.
> Affected files ...
>
> ..
> //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_pspinlock.c#7
> edit
>
> Differences ...
>
> ====
> //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_pspinlock.c#7
> (text+ko) ====
>
> @@ -100,6 +100,10 @@
> else {
> count = SPIN_COUNT;
> while ((ret = umtx_trylock(&lck->s_lock, self->tid)) != 0) {
> +#ifdef __i386__
> + /* tell cpu we are spinning */
> + __asm __volatile("pause");
> +#endif
> if (--count <= 0) {
> count = SPIN_COUNT;
> _pthread_yield();
> @@ -120,7 +124,7 @@
> if (lock == NULL || (lck = *lock) == NULL)
> ret = EINVAL;
> else {
> - ret =umtx_unlock(&lck->s_lock, self->tid);
> + ret = umtx_unlock(&lck->s_lock, self->tid);
> }
> return (ret);
> }
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the p4-projects
mailing list