Messages in this thread | | | From | James Sutherland <> | Subject | Re: pid hash question | Date | Sun, 19 Mar 2000 21:10:55 +0000 |
| |
On Fri, 17 Mar 2000 00:21:15 +0100, you wrote:
>Hi, > >The pid hash function in include/linux/sched.h looks like this: > >#define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1)) > >What is the point of the >> 8 ? Since pids are assigned linearly (more >or less), wouldn't ((x) & (PIDHASH_SZ - 1)) be just as good?
You are overlooking that XOR operator, I think?
Without the ((x)>>8), an 8 bit hash would map PIDs 2 and 258 to 2; with it, 2 maps to 2, 258 maps to 3.
Not a huge difference, perhaps, but it does make the hash less linear than the PIDs, at least.
James.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |