lkml.org 
[lkml]   [2000]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] system call acct

This patch against 2.4.0-test5-pre3 provides per-cpu system call counters
(for arch/i386 only so far), and exports them in /proc/interrupts. I'm
interested if anyone thinks this is useful or plain stupid, and/or if
anyone familiar with assembler for other archs wants to make similar
changes [note: this patch follow's Keith's recently posted patch which
also changed include/asm-i386/hardirq.h].

Lots of due care to avoid any performance degradation like syscall overhead,
SMP cacheline pingpong, etc. The changes use one of the spare fields
in irq_stat (which is cacheline aligned), and require a single additional
instruction to the ret_from_sys_call code path. Testing reveals no
statistically significant degradation in performance, i.e. on our
dual-cpu-PIII/550 system :

=== 2.2.4-test5 WITHOUT syscall acct ===
one process spinning in getpid
1816913 calls/second

two processes spinning in getpid:
1780061 calls/second
1778278 calls/second

clean kernel compile
210.310u 13.820s 3:43.81 100.1% 0+0k 0+0io 302915pf+0w
210.470u 14.090s 3:43.48 100.4% 0+0k 0+0io 302915pf+0w

=== 2.2.4-test5 WITH syscall acct ===
one process spinning in getpid
1815879 calls/second

two processes spinning in getpid:
1768717 calls/second
1763654 calls/second

clean kernel compile
207.460u 14.160s 3:40.83 100.3% 0+0k 0+0io 302915pf+0w
207.800u 14.300s 3:37.38 102.1% 0+0k 0+0io 302915pf+0w

The new /proc/interrupts looks like this:

icy 53% cat /proc/interrupts
CPU0 CPU1
0: 89722 99730 IO-APIC-edge timer
1: 2 0 IO-APIC-edge keyboard
2: 0 0 XT-PIC cascade
4: 168 162 IO-APIC-edge serial
13: 1 0 XT-PIC fpu
15: 1 3 IO-APIC-edge ide1
19: 27408 27300 IO-APIC-level aic7xxx, aic7xxx
21: 13432 13948 IO-APIC-level eth0
NMI: 189327 189327
LOC: 189299 189289
ERR: 0
SYS: 130768636 69891376 system calls

thanks
-- Mark Goodwin
SGI Engineering
---------------

--- linux/include/asm-i386/hardirq.h.orig Thu Jul 20 09:38:50 2000
+++ linux/include/asm-i386/hardirq.h Thu Jul 20 09:35:26 2000
@@ -9,7 +9,8 @@
unsigned int __local_irq_count;
unsigned int __local_bh_count;
unsigned int __nmi_counter;
- unsigned int __pad[5];
+ unsigned int __syscall_counter; /* this is updated in entry.S */
+ unsigned int __pad[4];
} ____cacheline_aligned irq_cpustat_t;

extern irq_cpustat_t irq_stat [NR_CPUS];
--- linux/arch/i386/kernel/entry.S.orig Thu Jul 20 09:39:21 2000
+++ linux/arch/i386/kernel/entry.S Thu Jul 20 09:34:44 2000
@@ -206,9 +206,11 @@
#ifdef CONFIG_SMP
movl processor(%ebx),%eax
shll $5,%eax
+ incl SYMBOL_NAME(irq_stat)+12(,%eax) # irq_stat.__syscall_counter
movl SYMBOL_NAME(softirq_state)(,%eax),%ecx
testl SYMBOL_NAME(softirq_state)+4(,%eax),%ecx
#else
+ incl SYMBOL_NAME(irq_stat)+12 # irq_stat.__syscall_counter
movl SYMBOL_NAME(softirq_state),%ecx
testl SYMBOL_NAME(softirq_state)+4,%ecx
#endif
--- linux/arch/i386/kernel/irq.c.orig Thu Jul 20 09:39:41 2000
+++ linux/arch/i386/kernel/irq.c Thu Jul 20 09:34:44 2000
@@ -170,6 +170,13 @@
p += sprintf(p, "\n");
#endif
p += sprintf(p, "ERR: %10lu\n", irq_err_count);
+
+ p += sprintf(p, "SYS: ");
+ for (j = 0; j < smp_num_cpus; j++)
+ p += sprintf(p, "%10u ",
+ irq_stat[cpu_logical_map(j)].__syscall_counter);
+ p += sprintf(p, " %14s\n", "system calls");
+
return p - buf;
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.026 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site