]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - kernel/kexec.c
[PATCH] kdump: dynamic per cpu allocation of memory for saving cpu registers
[net-next-2.6.git] / kernel / kexec.c
index 2c95848fbce8261463e54833d60d68573e9fb9b8..1197de8b2a949d1b8f8a8770d27b9b8e6a62cc3d 100644 (file)
@@ -26,6 +26,9 @@
 #include <asm/system.h>
 #include <asm/semaphore.h>
 
+/* Per cpu memory for storing cpu states in case of system crash. */
+note_buf_t* crash_notes;
+
 /* Location of the reserved area for the crash kernel */
 struct resource crashk_res = {
        .name  = "Crash kernel",
@@ -1060,3 +1063,16 @@ void crash_kexec(struct pt_regs *regs)
                xchg(&kexec_lock, 0);
        }
 }
+
+static int __init crash_notes_memory_init(void)
+{
+       /* Allocate memory for saving cpu registers. */
+       crash_notes = alloc_percpu(note_buf_t);
+       if (!crash_notes) {
+               printk("Kexec: Memory allocation for saving cpu register"
+               " states failed\n");
+               return -ENOMEM;
+       }
+       return 0;
+}
+module_init(crash_notes_memory_init)