[Patch] Scale pidhash_shift/pidhash_size up based on num_possible_cpus().

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Robin Holt
Date: Thursday, July 31, 2008 - 10:00 am

For large cpu configurations, we find the number of pids in a pidhash
bucket cause things like 'ps' to perform slowly.  Raising pidhash_shift
from 12 to 16 cut the time for 'ps' in half on a 2048 cpu machine.

This patch makes the upper limit scale based upon num_possible_cpus().
For machines 128 cpus or less, the current upper limit of 12 is
maintained.

Signed-off-by: Robin Holt <holt@sgi.com>


Index: contention_unroll/kernel/pid.c
===================================================================
--- contention_unroll.orig/kernel/pid.c	2008-07-31 11:59:21.154284073 -0500
+++ contention_unroll/kernel/pid.c	2008-07-31 11:59:22.862497720 -0500
@@ -502,9 +502,10 @@ void __init pidhash_init(void)
 {
 	int i, pidhash_size;
 	unsigned long megabytes = nr_kernel_pages >> (20 - PAGE_SHIFT);
+	int pidhash_shift_ul = max(12, fls(num_possible_cpus() - 1) + 5);
 
 	pidhash_shift = max(4, fls(megabytes * 4));
-	pidhash_shift = min(12, pidhash_shift);
+	pidhash_shift = min(pidhash_shift_ul, pidhash_shift);
 	pidhash_size = 1 << pidhash_shift;
 
 	printk("PID hash table entries: %d (order: %d, %Zd bytes)\n",
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Patch] Scale pidhash_shift/pidhash_size up based on num_p ..., Robin Holt, (Thu Jul 31, 10:00 am)
Re: [Patch] Scale pidhash_shift/pidhash_size up based on n ..., Eric W. Biederman, (Thu Jul 31, 11:35 am)
Re: [Patch] Scale pidhash_shift/pidhash_size up based on n ..., Eric W. Biederman, (Thu Jul 31, 12:49 pm)
Re: [Patch] Scale pidhash_shift/pidhash_size up based on n ..., Eric W. Biederman, (Thu Jul 31, 3:04 pm)
Re: [Patch] Scale pidhash_shift/pidhash_size up based on n ..., Eric W. Biederman, (Fri Aug 1, 11:27 am)
Re: [Patch] Scale pidhash_shift/pidhash_size up based on n ..., Eric W. Biederman, (Fri Aug 1, 12:59 pm)