提交 ac6b931c 编写于 作者: A Andi Kleen 提交者: Linus Torvalds

[PATCH] x86_64: Reduce NMI watchdog stack usage

NR_CPUs can be quite big these days.  kmalloc the per CPU array instead of
putting it onto the stack
Signed-off-by: NAndi Kleen <ak@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 71799062
...@@ -114,7 +114,7 @@ static __init int cpu_has_lapic(void) ...@@ -114,7 +114,7 @@ static __init int cpu_has_lapic(void)
static int __init check_nmi_watchdog (void) static int __init check_nmi_watchdog (void)
{ {
int counts[NR_CPUS]; int *counts;
int cpu; int cpu;
if (nmi_watchdog == NMI_NONE) if (nmi_watchdog == NMI_NONE)
...@@ -125,6 +125,12 @@ static int __init check_nmi_watchdog (void) ...@@ -125,6 +125,12 @@ static int __init check_nmi_watchdog (void)
return -1; return -1;
} }
counts = kmalloc(NR_CPUS * sizeof(int),GFP_KERNEL);
if (!counts) {
nmi_watchdog = NMI_NONE;
return 0;
}
printk(KERN_INFO "Testing NMI watchdog ... "); printk(KERN_INFO "Testing NMI watchdog ... ");
for (cpu = 0; cpu < NR_CPUS; cpu++) for (cpu = 0; cpu < NR_CPUS; cpu++)
...@@ -139,6 +145,7 @@ static int __init check_nmi_watchdog (void) ...@@ -139,6 +145,7 @@ static int __init check_nmi_watchdog (void)
cpu_pda[cpu].__nmi_count); cpu_pda[cpu].__nmi_count);
nmi_active = 0; nmi_active = 0;
lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG;
kfree(counts);
return -1; return -1;
} }
} }
...@@ -149,6 +156,7 @@ static int __init check_nmi_watchdog (void) ...@@ -149,6 +156,7 @@ static int __init check_nmi_watchdog (void)
if (nmi_watchdog == NMI_LOCAL_APIC) if (nmi_watchdog == NMI_LOCAL_APIC)
nmi_hz = 1; nmi_hz = 1;
kfree(counts);
return 0; return 0;
} }
/* Have this called later during boot so counters are updating */ /* Have this called later during boot so counters are updating */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册