public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.4.19-pre2] Make max_threads be based on normal zone size
@ 2002-03-01 17:38 Dave McCracken
  0 siblings, 0 replies; 3+ messages in thread
From: Dave McCracken @ 2002-03-01 17:38 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]


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

[-- Attachment #2: memsize-2.4.19-pre2.diff --]
[-- Type: text/plain, Size: 2372 bytes --]

--- 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);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.4.19-pre2] Make max_threads be based on normal zone size
       [not found] <71650000.1015004327@baldur.suse.lists.linux.kernel>
@ 2002-03-01 18:14 ` Andi Kleen
  2002-03-01 18:19   ` Dave McCracken
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2002-03-01 18:14 UTC (permalink / raw)
  To: Dave McCracken; +Cc: linux-kernel

Dave McCracken <dmccr@us.ibm.com> writes:

> 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.

There are lots of other functions with the same problem (like all the 
hash table sizing and others). Perhaps these should be fixed too? 

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.4.19-pre2] Make max_threads be based on normal zone size
  2002-03-01 18:14 ` Andi Kleen
@ 2002-03-01 18:19   ` Dave McCracken
  0 siblings, 0 replies; 3+ messages in thread
From: Dave McCracken @ 2002-03-01 18:19 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel


--On Friday, March 01, 2002 19:14:41 +0100 Andi Kleen <ak@suse.de> wrote:

> There are lots of other functions with the same problem (like all the 
> hash table sizing and others). Perhaps these should be fixed too? 

I coded the patch in a fashion that makes both total physical memory and
mapped physical memory size available, specifically so other people could
change places that might also have the same problem.  I guessed there might
be some.

Dave McCracken

======================================================================
Dave McCracken          IBM Linux Base Kernel Team      1-512-838-3059
dmccr@us.ibm.com                                        T/L   678-3059


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-01 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-01 17:38 [PATCH 2.4.19-pre2] Make max_threads be based on normal zone size Dave McCracken
     [not found] <71650000.1015004327@baldur.suse.lists.linux.kernel>
2002-03-01 18:14 ` Andi Kleen
2002-03-01 18:19   ` Dave McCracken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox