Messages in this thread Patch in this message | | | Date | Fri, 01 Mar 2002 11:38:47 -0600 | From | Dave McCracken <> | Subject | [PATCH 2.4.19-pre2] 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 dmccr@us.ibm.com T/L 678-3059 --- linux-2.4.19-pre2/./init/main.c Thu Feb 28 16:06:01 2002 +++ linux-2.4.19-pre2-memsize/./init/main.c Fri Mar 1 09:44:15 2002 @@ -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 --- linux-2.4.19-pre2/./mm/memory.c Thu Feb 28 16:06:02 2002 +++ linux-2.4.19-pre2-memsize/./mm/memory.c Thu Feb 28 16:34:06 2002 @@ -52,6 +52,7 @@ unsigned long max_mapnr; unsigned long num_physpages; +unsigned long num_mappedpages; void * high_memory; struct page *highmem_start_page; --- linux-2.4.19-pre2/./include/linux/mm.h Thu Feb 28 16:06:01 2002 +++ linux-2.4.19-pre2-memsize/./include/linux/mm.h Fri Mar 1 09:44:17 2002 @@ -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. */ --- linux-2.4.19-pre2/./arch/i386/mm/init.c Fri Dec 21 11:41:53 2001 +++ linux-2.4.19-pre2-memsize/./arch/i386/mm/init.c Thu Feb 28 16:34:06 2002 @@ -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);
| |