From: Mikael Pettersson <mikpe@csd.uu.se>
To: torvalds@transmeta.com
Cc: davej@suse.de, linux-kernel@vger.kernel.org
Subject: [PATCH] shrink check_nmi_watchdog stack frame
Date: Sun, 16 Jun 2002 13:41:53 +0200 (MET DST) [thread overview]
Message-ID: <200206161141.NAA13660@harpo.it.uu.se> (raw)
This patch for 2.5.21 reduces the stack frame size of
arch/i386/kernel/nmi.c:check_nmi_watchdog() from 4096 bytes
in the worst case to 128 bytes. Linus, please apply.
The problem with the current code is that it copies the entire
irq_stat[] array, when only a single field (__nmi_count) is of
interest. The irq_stat_t element type is only 28 bytes, but it
is also ____cacheline_aligned, and that blows the array up to
4096 bytes on SMP P4 Xeons, 2048 bytes on SMP K7s, and 1024 bytes
on SMP P5/P6s. The patch reduces this to NR_CPUS*4==128 bytes.
If you approve this patch I'll also send one to Marcelo for 2.4.
/Mikael
diff -ruN linux-2.5.21/arch/i386/kernel/nmi.c linux-2.5.21.check-nmi/arch/i386/kernel/nmi.c
--- linux-2.5.21/arch/i386/kernel/nmi.c Mon Apr 15 00:32:51 2002
+++ linux-2.5.21.check-nmi/arch/i386/kernel/nmi.c Sun Jun 16 12:16:55 2002
@@ -72,18 +72,19 @@
int __init check_nmi_watchdog (void)
{
- irq_cpustat_t tmp[NR_CPUS];
+ unsigned int prev_nmi_count[NR_CPUS];
int j, cpu;
printk(KERN_INFO "testing NMI watchdog ... ");
- memcpy(tmp, irq_stat, sizeof(tmp));
+ for(j = 0; j < NR_CPUS; ++j)
+ prev_nmi_count[j] = irq_stat[j].__nmi_count;
sti();
mdelay((10*1000)/nmi_hz); // wait 10 ticks
for (j = 0; j < smp_num_cpus; j++) {
cpu = cpu_logical_map(j);
- if (nmi_count(cpu) - tmp[cpu].__nmi_count <= 5) {
+ if (nmi_count(cpu) - prev_nmi_count[cpu] <= 5) {
printk("CPU#%d: NMI appears to be stuck!\n", cpu);
return -1;
}
next reply other threads:[~2002-06-16 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-16 11:41 Mikael Pettersson [this message]
2002-07-25 16:06 Mikael Pettersson
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=200206161141.NAA13660@harpo.it.uu.se \
--to=mikpe@csd.uu.se \
--cc=davej@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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
all inboxes | Powered by JetHome®