Re: [PATCH] Make `hash_long' function work if bits parameter is 0.

From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Dec 06 2002 - 13:16:41 EST


On Fri, 6 Dec 2002, Miles Bader wrote:
>
> The reason I sent the patch is because I ran into a case where the return
> value _should_ be zero -- on a machine with very little memory (1MB), the
> page wait-queue hash-table ends up having only one bucket (it has 256 pages,
> and the code tries to make a wait-queue for every 256 pages....). The 0 is
> returned by the `wait_table_bits' function in mm/page_alloc.c.

Ahh, ok. Fair enough, but I do have to say that I consider a hash of size
1 to be kind of useless, so even then I think the right approach is:

> I suppose an alternative in this case is to special-case above
> calculation to peg the minimum at 1.

Yup. It needs a special case _somewhere_, and I suspect it's clearer to
just make the special case be where the issue is.

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:27 EST