]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix PID hash sizing
authorNick Piggin <nickpiggin@yahoo.com.au>
Tue, 31 Aug 2004 03:35:49 +0000 (20:35 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 31 Aug 2004 03:35:49 +0000 (20:35 -0700)
A 4GB, 4-way Opteron would create the smallest size table (16 entries) because
pidhash_init is called before mem_init which is where x86-64 sets up max_pfn.

nr_kernel_pages is setup by paging_init, called from setup_arch, which is also
where i386 sets up max_pfn.

So export nr_kernel_pages, nr_all_pages.  Use nr_kernel_pages when sizing the
PID hash.  This fixes the problem.

This also makes the pid hash dependant on the size of ZONE_NORMAL instead of
total size of memory.

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/bootmem.h
kernel/pid.c
mm/page_alloc.c

index e038f9a3d0ef27fab38720046eced1ba59835b29..376a5500a7a6872dd6d553a36adc5a000ab548cb 100644 (file)
@@ -67,6 +67,9 @@ extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size,
        __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
 #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
 
+extern unsigned long __initdata nr_kernel_pages;
+extern unsigned long __initdata nr_all_pages;
+
 extern void *__init alloc_large_system_hash(const char *tablename,
                                            unsigned long bucketsize,
                                            unsigned long numentries,
index 6ed44f56ca456f91d2e1a941043a8628091d8f98..11d834532302543c0aa65497b2af263e70b2f86a 100644 (file)
@@ -271,7 +271,7 @@ void switch_exec_pids(task_t *leader, task_t *thread)
 void __init pidhash_init(void)
 {
        int i, j, pidhash_size;
-       unsigned long megabytes = max_pfn >> (20 - PAGE_SHIFT);
+       unsigned long megabytes = nr_kernel_pages >> (20 - PAGE_SHIFT);
 
        pidhash_shift = max(4, fls(megabytes * 4));
        pidhash_shift = min(12, pidhash_shift);
index ce877b9e223e6d721eaa4fcfa394dfea645e5cc7..327f35787fe26d12497794cdf8dccb2eccb95bb1 100644 (file)
@@ -55,8 +55,8 @@ EXPORT_SYMBOL(zone_table);
 static char *zone_names[MAX_NR_ZONES] = { "DMA", "Normal", "HighMem" };
 int min_free_kbytes = 1024;
 
-static unsigned long __initdata nr_kernel_pages;
-static unsigned long __initdata nr_all_pages;
+unsigned long __initdata nr_kernel_pages;
+unsigned long __initdata nr_all_pages;
 
 /*
  * Temporary debugging check for pages not lying within a given zone.