PERFORCE change 65074 for review

John Baldwin jhb at FreeBSD.org
Mon Nov 15 10:53:16 PST 2004


On Sunday 14 November 2004 12:13 am, David Xu wrote:
> http://perforce.freebsd.org/chv.cgi?CH=65074
>
> Change 65074 by davidxu at davidxu_alona on 2004/11/14 05:12:40
>
> 	1. Fix a race between signal and umtx_unlock. a waiter
> 	   may be resumed by signal and left or exited, heavily
> 	   loaded test causes kernel to crash.
> 	2. Use distributed queue locks instead of single giant
> 	   lock.
>
> Affected files ...
>
> .. //depot/projects/davidxu_ksedbg/src/sys/kern/kern_umtx.c#4 edit
>
> Differences ...
>
> ==== //depot/projects/davidxu_ksedbg/src/sys/kern/kern_umtx.c#4 (text+ko)
> ====
>
> @@ -49,25 +49,48 @@
>  	pid_t		uq_pid;		/* Pid key component. */
>  };
>
>  #define	UMTX_QUEUES	128
>  #define	UMTX_HASH(pid, umtx)						\
> -    (((uintptr_t)pid + ((uintptr_t)umtx & ~65535)) % UMTX_QUEUES)
> +    ((((uintptr_t)pid << 16) + ((uintptr_t)umtx & 65535)) % UMTX_QUEUES)

I'm curious why you changed the hash macro here?  Low order bits of pointers 
tend to be zero due to alignment, so I think this will result in fewer 
"useful" bits and more collisions and longer chains.

-- 
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