From: Andi Kleen <ak@suse.de>
To: peterz@infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH x86] [7/16] Convert lockdep to use arch_early_alloc() if available for its large arrays
Date: Thu, 3 Jan 2008 16:42:21 +0100 (CET) [thread overview]
Message-ID: <20080103154221.1CC8C14DDB@wotan.suse.de> (raw)
In-Reply-To: <20080103442.621670000@suse.de>
The static arrays in lockdep can be quite big. Upto several megabytes.
We ran into problems with 64bit kernels becoming so big that the kernel
image overlapped into the 16MB area reserved for a kdump kernel.
This patch converts lockdep to use arch_early_alloc() if available
to avoid this problem.
Cc: peterz@infradead.org
Signed-off-by: Andi Kleen <ak@suse.de>
---
kernel/lockdep.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
Index: linux/kernel/lockdep.c
===================================================================
--- linux.orig/kernel/lockdep.c
+++ linux/kernel/lockdep.c
@@ -109,7 +109,7 @@ static inline int debug_locks_off_graph_
static int lockdep_initialized;
unsigned long nr_list_entries;
-static struct lock_list list_entries[MAX_LOCKDEP_ENTRIES];
+static struct lock_list *list_entries;
/*
* All data structures here are protected by the global debug_lock.
@@ -118,7 +118,7 @@ static struct lock_list list_entries[MAX
* get freed - this significantly simplifies the debugging code.
*/
unsigned long nr_lock_classes;
-static struct lock_class lock_classes[MAX_LOCKDEP_KEYS];
+static struct lock_class *lock_classes;
#ifdef CONFIG_LOCK_STAT
static DEFINE_PER_CPU(struct lock_class_stats[MAX_LOCKDEP_KEYS], lock_stats);
@@ -257,7 +257,7 @@ static struct list_head classhash_table[
#define __chainhashfn(chain) hash_long(chain, CHAINHASH_BITS)
#define chainhashentry(chain) (chainhash_table + __chainhashfn((chain)))
-static struct list_head chainhash_table[CHAINHASH_SIZE];
+static struct list_head *chainhash_table;
/*
* The hash key of the lock dependency chains is a hash itself too:
@@ -332,7 +332,7 @@ static int verbose(struct lock_class *cl
* addresses. Protected by the graph_lock.
*/
unsigned long nr_stack_trace_entries;
-static unsigned long stack_trace[MAX_STACK_TRACE_ENTRIES];
+static unsigned long *stack_trace;
static int save_trace(struct stack_trace *trace)
{
@@ -1454,7 +1454,7 @@ out_bug:
}
unsigned long nr_lock_chains;
-static struct lock_chain lock_chains[MAX_LOCKDEP_CHAINS];
+static struct lock_chain *lock_chains;
/*
* Look up a dependency chain. If the key is not present yet then
@@ -3010,6 +3010,27 @@ out_restore:
raw_local_irq_restore(flags);
}
+/*
+ * The large arrays can bloat the kernel image too much causing problems
+ * because it needs an continuous area in memory. Allocate them
+ * using a special allocator if possible. This is before bootmem and only
+ * works on some architectures.
+ */
+
+#ifndef ARCH_HAS_EARLY_ALLOC
+#define LARGEVAR(x,y) { static typeof(*x) __ ## x[y]; x = __ ## x; }
+#else
+#define LARGEVAR(x,y) x = arch_early_alloc(sizeof(*x) * y)
+#endif
+
+void lockdep_init_mem(void)
+{
+ LARGEVAR(stack_trace, MAX_STACK_TRACE_ENTRIES);
+ LARGEVAR(list_entries, MAX_LOCKDEP_ENTRIES);
+ LARGEVAR(lock_chains, MAX_LOCKDEP_CHAINS);
+ LARGEVAR(lock_classes, MAX_LOCKDEP_KEYS);
+ LARGEVAR(chainhash_table, CHAINHASH_SIZE);
+}
void lockdep_init(void)
{
int i;
@@ -3023,6 +3044,8 @@ void lockdep_init(void)
if (lockdep_initialized)
return;
+ lockdep_init_mem();
+
for (i = 0; i < CLASSHASH_SIZE; i++)
INIT_LIST_HEAD(classhash_table + i);
next prev parent reply other threads:[~2008-01-03 15:44 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 15:42 [PATCH x86] [0/16] Various i386/x86-64 changes Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [1/16] Make clocksource watchdog cycle through online CPUs Andi Kleen
2008-01-04 8:51 ` Ingo Molnar
2008-01-04 12:59 ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [2/16] Add a counter for per cpu clocksource watchdog checks and report them in /proc/interrupts Andi Kleen
2008-01-04 8:53 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [3/16] Turn irq debugging options into module params Andi Kleen
2008-01-04 8:55 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [4/16] Add /proc/irq/*/spurious to dump the spurious irq debugging state Andi Kleen
2008-01-04 8:58 ` Ingo Molnar
2008-01-04 12:22 ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [5/16] Replace hard coded reservations in x86-64 early boot code with dynamic table Andi Kleen
2008-01-04 9:00 ` Ingo Molnar
2008-01-04 12:23 ` Andi Kleen
2008-01-04 12:38 ` [PATCH x86] [5/16] Replace hard coded reservations in x86-64 early boot code with dynamic table II Andi Kleen
2008-01-04 14:41 ` Ingo Molnar
2008-01-04 15:03 ` Andi Kleen
2008-01-04 17:51 ` Sam Ravnborg
2008-01-04 18:06 ` Andi Kleen
2008-01-04 18:47 ` Joe Perches
2008-01-04 22:13 ` Andi Kleen
2008-01-04 22:46 ` J. Bruce Fields
2008-01-04 20:56 ` Sam Ravnborg
2008-01-04 12:41 ` [PATCH x86] [5/16] Replace hard coded reservations in x86-64 early boot code with dynamic table Cyrill Gorcunov
2008-01-03 15:42 ` [PATCH x86] [6/16] Add a new arch_early_alloc() interface for x86-64 Andi Kleen
2008-01-03 16:22 ` Eric Dumazet
2008-01-03 17:17 ` Andi Kleen
2008-01-03 15:42 ` Andi Kleen [this message]
2008-01-04 9:03 ` [PATCH x86] [7/16] Convert lockdep to use arch_early_alloc() if available for its large arrays Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [8/16] Make lockdep_init __init Andi Kleen
2008-01-04 9:06 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [9/16] Remove CPU capabitilites printks on i386 Andi Kleen
2008-01-04 9:11 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [10/16] Document fdimage/isoimage completely in make help Andi Kleen
2008-01-04 9:00 ` Sam Ravnborg
2008-01-04 9:15 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [11/16] Compile apm and voyager module only when selected in Kconfig Andi Kleen
2008-01-04 4:15 ` Stephen Rothwell
2008-01-03 15:42 ` [PATCH x86] [12/16] Optimize lock prefix switching to run less frequently Andi Kleen
2008-01-04 9:42 ` Thomas Gleixner
2008-01-04 12:17 ` Andi Kleen
2008-01-04 14:19 ` Thomas Gleixner
2008-01-04 14:39 ` Andi Kleen
2008-01-04 15:02 ` Pekka Enberg
2008-01-04 15:04 ` Andi Kleen
2008-01-04 20:34 ` Thomas Gleixner
2008-01-04 22:11 ` Andi Kleen
2008-01-05 1:19 ` Ingo Molnar
2008-01-05 14:37 ` Andi Kleen
2008-01-03 15:42 ` [PATCH x86] [13/16] i386: Set CFQ as default in i386 defconfig Andi Kleen
2008-01-04 9:19 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [14/16] Enable RDC321X subarch only on 32bit Andi Kleen
2008-01-04 9:22 ` Ingo Molnar
2008-01-03 15:42 ` [PATCH x86] [15/16] Force __cpuinit on for CONFIG_PM without HOTPLUG_CPU Andi Kleen
2008-01-03 17:22 ` Rafael J. Wysocki
2008-01-03 17:42 ` Andi Kleen
2008-01-03 21:41 ` Rafael J. Wysocki
2008-01-04 9:23 ` Ingo Molnar
2008-01-10 17:14 ` Rafael J. Wysocki
2008-01-03 18:14 ` Adrian Bunk
2008-01-03 18:43 ` Andi Kleen
2008-01-10 9:54 ` Adrian Bunk
2008-01-10 9:58 ` Andi Kleen
2008-01-10 10:19 ` Adrian Bunk
2008-01-10 11:15 ` Andi Kleen
2008-01-10 11:26 ` Adrian Bunk
2008-01-10 11:42 ` Andi Kleen
2008-01-10 12:47 ` Adrian Bunk
2008-01-10 13:12 ` Andi Kleen
2008-01-10 15:09 ` Adrian Bunk
2008-01-14 13:52 ` Ingo Molnar
2008-01-14 14:09 ` Sam Ravnborg
2008-01-14 14:58 ` Ingo Molnar
2008-01-14 15:01 ` Ingo Molnar
2008-01-14 18:20 ` Adrian Bunk
2008-01-14 19:10 ` Ingo Molnar
2008-01-14 19:52 ` Adrian Bunk
2008-01-14 20:01 ` Sam Ravnborg
2008-01-14 20:18 ` Adrian Bunk
2008-01-14 20:27 ` Sam Ravnborg
2008-01-14 20:34 ` Adrian Bunk
2008-01-15 22:14 ` Ingo Molnar
2008-01-15 22:51 ` Adrian Bunk
2008-01-14 19:59 ` Sam Ravnborg
2008-01-15 22:12 ` [patch for v2.6.24] fix section mismatch warning in page_alloc.c Ingo Molnar
2008-01-14 15:05 ` [PATCH x86] [15/16] Force __cpuinit on for CONFIG_PM without HOTPLUG_CPU Ingo Molnar
2008-01-14 15:24 ` Ingo Molnar
2008-01-14 20:12 ` Sam Ravnborg
2008-01-15 15:17 ` Ingo Molnar
2008-01-15 16:25 ` Sam Ravnborg
2008-01-15 17:11 ` Andi Kleen
2008-01-15 17:27 ` Adrian Bunk
2008-01-15 18:21 ` Sam Ravnborg
2008-01-15 18:29 ` Andi Kleen
2008-01-15 18:31 ` Sam Ravnborg
2008-01-15 18:47 ` Adrian Bunk
2008-01-14 18:17 ` Adrian Bunk
2008-01-14 15:25 ` Adrian Bunk
2008-01-10 17:17 ` Rafael J. Wysocki
2008-01-11 23:06 ` [PATCH] x86: Change unnecessary dependencies on CONFIG_PM Rafael J. Wysocki
2008-01-03 15:42 ` [PATCH x86] [16/16] Mark memory_setup __init Andi Kleen
2008-01-04 9:25 ` Ingo Molnar
2008-01-04 9:53 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080103154221.1CC8C14DDB@wotan.suse.de \
--to=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome