diff -urN linux-2.4.17-rc2-virgin/include/linux/sched.h linux-2.4.17-rc2-wli2/include/linux/sched.h --- linux-2.4.17-rc2-virgin/include/linux/sched.h Tue Dec 18 23:18:03 2001 +++ linux-2.4.17-rc2-wli2/include/linux/sched.h Thu Dec 20 18:55:14 2001 @@ -560,11 +556,22 @@ extern struct mm_struct init_mm; extern struct task_struct *init_tasks[NR_CPUS]; +/* + * A pid hash function using a prime near golden + * ratio to the machine word size (32 bits). The + * results of this are unknown. + * + * Added shift to extract high-order bits of computed + * hash function. + * -- wli + */ + /* PID hashing. (shouldnt this be dynamic?) */ #define PIDHASH_SZ (4096 >> 2) +#define PIDHASH_BITS 10 extern struct task_struct *pidhash[PIDHASH_SZ]; - -#define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1)) +#define pid_hashfn(x) \ + (((2654435761UL*(x)) >> (BITS_PER_LONG-PIDHASH_BITS)) & (PIDHASH_SZ-1)) static inline void hash_pid(struct task_struct *p) {