[PATCH] Make sure the size of a wait-queue hashtable isn't 1

From: Miles Bader (miles@lsi.nec.co.jp)
Date: Mon Dec 09 2002 - 04:02:11 EST


The hash_long function in <linux/hash.h> returns bogus results for size
1 hashtables, and wait-queue hashtables can reach that limit for
small-memory systems, so this patch makes the minimum size 4.

This fix was suggested by Andrew Morton.

diff -ruN -X../cludes ../orig/linux-2.5.50-uc0/mm/page_alloc.c mm/page_alloc.c
--- ../orig/linux-2.5.50-uc0/mm/page_alloc.c 2002-11-25 10:30:10.000000000 +0900
+++ mm/page_alloc.c 2002-12-09 11:33:33.000000000 +0900
@@ -961,7 +961,9 @@
          */
         size = min(size, 4096UL);
 
- return size;
+ /* The `hash_long' function can't handle tables of size 1, so make
+ sure we don't create one. */
+ return max(size, 4UL);
 }
 
 /*
-
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 : Sun Dec 15 2002 - 22:00:14 EST