Skip to contentSkip to conversation

Get rid of __syscall_count.

PATCH In review Rusty Russell 2 participants 2 messages Jul 1, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

include/asm-i386/hardirq.h +0 -1
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
@@ -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 */
include/linux/irq_cpustat.h +0 -2
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
@@ -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())
 
#1 lore raw
Quoted 4 lines · Rusty Russell

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.

include/asm-i386/hardirq.h renamed from include/asm-i386/hardirq.h.orig +2 -1
@@ -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];
arch/i386/kernel/entry.S renamed from arch/i386/kernel/entry.S.orig +2 -0
@@ -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
arch/i386/kernel/irq.c renamed from arch/i386/kernel/irq.c.orig +7 -0
@@ -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