2003-07-01 05:32:18

by Rusty Russell

[permalink] [raw]
Subject: [PATCH] Get rid of __syscall_count.

Linus, please apply, unless someone has plans for this field.

Noone seems to use __syscall_count. Remove the field from i386
irq_cpustat_t struct, and the generic accessor macros.

Because some archs have hardcoded asm references to offsets in this
structure, I haven't touched non-x86, but doing so is usually
trivial.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Remove unused __syscall_count from irq_stat struct.
Author: Rusty Russell
Status: Tested on 2.5.73-bk8

D: Noone seems to use __syscall_count. Remove the field from i386
D: irq_cpustat_t struct, and the generic accessor macros.
D:
D: Because some archs have hardcoded asm references to offsets in this
D: structure, I haven't touched non-x86, but doing so is usually
D: trivial.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .2143-linux-2.5.73-bk8/include/asm-i386/hardirq.h .2143-linux-2.5.73-bk8.updated/include/asm-i386/hardirq.h
--- .2143-linux-2.5.73-bk8/include/asm-i386/hardirq.h 2003-04-08 11:14:55.000000000 +1000
+++ .2143-linux-2.5.73-bk8.updated/include/asm-i386/hardirq.h 2003-07-01 13:49:21.000000000 +1000
@@ -7,7 +7,6 @@

typedef struct {
unsigned int __softirq_pending;
- unsigned int __syscall_count;
struct task_struct * __ksoftirqd_task; /* waitqueue is too large */
unsigned long idle_timestamp;
unsigned int __nmi_count; /* arch dependent */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .2143-linux-2.5.73-bk8/include/linux/irq_cpustat.h .2143-linux-2.5.73-bk8.updated/include/linux/irq_cpustat.h
--- .2143-linux-2.5.73-bk8/include/linux/irq_cpustat.h 2003-06-15 11:30:08.000000000 +1000
+++ .2143-linux-2.5.73-bk8.updated/include/linux/irq_cpustat.h 2003-07-01 13:48:58.000000000 +1000
@@ -29,8 +29,6 @@ extern irq_cpustat_t irq_stat[]; /* def
/* arch independent irq_stat fields */
#define softirq_pending(cpu) __IRQ_STAT((cpu), __softirq_pending)
#define local_softirq_pending() softirq_pending(smp_processor_id())
-#define syscall_count(cpu) __IRQ_STAT((cpu), __syscall_count)
-#define local_syscall_count() syscall_count(smp_processor_id())
#define ksoftirqd_task(cpu) __IRQ_STAT((cpu), __ksoftirqd_task)
#define local_ksoftirqd_task() ksoftirqd_task(smp_processor_id())


2003-07-01 05:59:15

by Keith Owens

[permalink] [raw]
Subject: Re: [PATCH] Get rid of __syscall_count.

On Tue, 01 Jul 2003 15:36:25 +1000,
Rusty Russell <[email protected]> wrote:
>Linus, please apply, unless someone has plans for this field.
>
>Noone seems to use __syscall_count. Remove the field from i386
>irq_cpustat_t struct, and the generic accessor macros.

The __syscall_count field was added around 2.4.0-test5-pre6 for
performance monitoring and detection of runaway processes. For reasons
that have long since passed beyond recall, the asm specific bits never
got added. This was the original patch.

--- 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;
}


# 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