lkml.org 
[lkml]   [2002]   [Dec]   [9]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
Patch in this message
/
Subject[PATCH] Make sure the size of a wait-queue hashtable isn't 1
DateMon, 9 Dec 2002 18:02:11 +0900 (JST)
From(Miles Bader)
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/
\
 
 \ /
  Last update: 2005-03-22 11:31    [W:0.275 / U:0.040 seconds]
©2003-2008 Jasper Spaans