Make max_threads be based on normal zone size
Subsystems (2)
PATCH 1/1 Make max_threads be based on normal zone size
The max_threads config parameter (used to determine how many tasks to allow) is currently calculated based on the total amount of physical memory in the machine. This is wrong, since the real limiting factor is the amount of memory in the normal zone.
This patch fixes the initialization of max_threads by allowing an architecture to specify how much memory is in the normal zone, and using that value to initialize max_threads.
My apologies for sending it as an attachment, but I don't trust my mail client not to screw up an inline patch.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
[email protected] T/L 678-3059
./init/main.c +14 -7
@@ -348,7 +348,6 @@ asmlinkage void __init start_kernel(void) {char * command_line; -unsigned long mempages;extern char saved_command_line[];/* * Interrupts are still disabled. Do necessary setups, then
@@ -399,13 +398,21 @@kmem_cache_sizes_init ();pgtable_cache_init (); - mempages = num_physpages; - -fork_init (mempages); +/* +* For architectures that have highmem, num_mappedpages represents +* the amount of memory the kernel can use. For other architectures +* it's the same as the total pages. We need both numbers because +* some subsystems need to initialize based on how much memory the +* kernel can use. +*/ +if (num_mappedpages ==0 ) + num_mappedpages = num_physpages; + +fork_init (num_mappedpages);proc_caches_init (); -vfs_caches_init (mempages); -buffer_init (mempages); -page_cache_init (mempages); +vfs_caches_init (num_physpages); +buffer_init (num_physpages); +page_cache_init (num_physpages);#if defined(CONFIG_ARCH_S390 )ccwcache_init ();#endif
./mm/memory.c +1 -0
@@ -52,6 +52,7 @@unsigned long max_mapnr;unsigned long num_physpages; +unsigned long num_mappedpages;void * high_memory;struct page *highmem_start_page;
./include/linux/mm.h +1 -0
@@ -15,6 +15,7 @@extern unsigned long max_mapnr;extern unsigned long num_physpages; +extern unsigned long num_mappedpages;extern void * high_memory;extern int page_cluster;/* The inactive_clean lists are per zone. */
./arch/i386/mm/init.c +2 -1
@@ -462,8 +462,9 @@#ifdef CONFIG_HIGHMEM highmem_start_page = mem_map + highstart_pfn; max_mapnr = num_physpages = highend_pfn; + num_mappedpages = max_low_pfn;#else - max_mapnr = num_physpages = max_low_pfn; + max_mapnr = num_mappedpages = num_physpages = max_low_pfn;#endif high_memory = (void *)__va (max_low_pfn *PAGE_SIZE );