Date: Mon, 4 Apr 2005 19:08:58 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 74466 for review Message-ID: <200504041908.j34J8wil062517@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=74466 Change 74466 by jhb@jhb_slimer on 2005/04/04 19:08:11 Use PCPU_LAZY_INC() more to try to reduce atomic ops. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/interrupt.c#33 edit .. //depot/projects/smpng/sys/alpha/alpha/trap.c#57 edit .. //depot/projects/smpng/sys/amd64/amd64/intr_machdep.c#10 edit .. //depot/projects/smpng/sys/amd64/amd64/trap.c#23 edit .. //depot/projects/smpng/sys/amd64/ia32/ia32_syscall.c#8 edit .. //depot/projects/smpng/sys/arm/arm/trap.c#9 edit .. //depot/projects/smpng/sys/arm/arm/undefined.c#6 edit .. //depot/projects/smpng/sys/i386/i386/intr_machdep.c#13 edit .. //depot/projects/smpng/sys/i386/i386/trap.c#74 edit .. //depot/projects/smpng/sys/ia64/ia32/ia32_trap.c#3 edit .. //depot/projects/smpng/sys/ia64/ia64/interrupt.c#28 edit .. //depot/projects/smpng/sys/ia64/ia64/trap.c#72 edit .. //depot/projects/smpng/sys/kern/kern_intr.c#66 edit .. //depot/projects/smpng/sys/notes#34 edit .. //depot/projects/smpng/sys/powerpc/powerpc/trap.c#43 edit .. //depot/projects/smpng/sys/sparc64/sparc64/trap.c#60 edit Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/interrupt.c#33 (text+ko) ==== @@ -139,7 +139,7 @@ break; case ALPHA_INTR_DEVICE: /* I/O device interrupt */ - cnt.v_intr++; + PCPU_LAZY_INC(cnt.v_intr); if (platform.iointr) (*platform.iointr)(framep, a1); break; @@ -462,7 +462,7 @@ alpha_clock_interrupt(struct trapframe *framep) { - cnt.v_intr++; + PCPU_LAZY_INC(cnt.v_intr); #ifdef EVCNT_COUNTERS clock_intr_evcnt.ev_count++; #else ==== //depot/projects/smpng/sys/alpha/alpha/trap.c#57 (text+ko) ==== @@ -295,7 +295,7 @@ * Giant hasn't been acquired yet. */ - cnt.v_trap++; + PCPU_LAZY_INC(cnt.v_trap); ucode = 0; user = (framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0; CTR5(KTR_TRAP, "%s trap: pid %d, (%lx, %lx, %lx)", @@ -655,7 +655,7 @@ panic("syscall"); #endif - cnt.v_syscall++; + PCPU_LAZY_INC(cnt.v_syscall); td->td_frame = framep; opc = framep->tf_regs[FRAME_PC] - 4; sticks = td->td_sticks; ==== //depot/projects/smpng/sys/amd64/amd64/intr_machdep.c#10 (text+ko) ==== @@ -167,7 +167,7 @@ * processed too. */ (*isrc->is_count)++; - cnt.v_intr++; + PCPU_LAZY_INC(cnt.v_intr); it = isrc->is_ithread; if (it == NULL) ==== //depot/projects/smpng/sys/amd64/amd64/trap.c#23 (text+ko) ==== @@ -162,7 +162,7 @@ u_int sticks = 0; int i = 0, ucode = 0, type, code; - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); type = frame.tf_trapno; #ifdef KDB ==== //depot/projects/smpng/sys/amd64/ia32/ia32_syscall.c#8 (text+ko) ==== @@ -106,7 +106,7 @@ * note: PCPU_LAZY_INC() can only be used if we can afford * occassional inaccuracy in the count. */ - cnt.v_syscall++; + PCPU_LAZY_INC(cnt.v_syscall); sticks = td->td_sticks; td->td_frame = &frame; ==== //depot/projects/smpng/sys/arm/arm/trap.c#9 (text+ko) ==== @@ -251,7 +251,7 @@ td = curthread; p = td->td_proc; - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); /* Data abort came from user mode? */ user = TRAP_USERMODE(tf); @@ -716,7 +716,7 @@ td = curthread; p = td->td_proc; - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); if (TRAP_USERMODE(tf)) { td->td_frame = tf; @@ -867,7 +867,7 @@ int locked = 0; u_int sticks = 0; - atomic_add_int(&cnt.v_syscall, 1); + PCPU_LAZY_INC(cnt.v_syscall); sticks = td->td_sticks; if (td->td_ucred != td->td_proc->p_ucred) cred_update_thread(td); ==== //depot/projects/smpng/sys/arm/arm/undefined.c#6 (text+ko) ==== @@ -185,7 +185,7 @@ enable_interrupts(I32_bit); frame->tf_pc -= INSN_SIZE; - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); fault_pc = frame->tf_pc; ==== //depot/projects/smpng/sys/i386/i386/intr_machdep.c#13 (text+ko) ==== @@ -167,7 +167,7 @@ * processed too. */ (*isrc->is_count)++; - cnt.v_intr++; + PCPU_LAZY_INC(cnt.v_intr); it = isrc->is_ithread; if (it == NULL) ==== //depot/projects/smpng/sys/i386/i386/trap.c#74 (text+ko) ==== @@ -180,7 +180,7 @@ static int lastalert = 0; #endif - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); type = frame.tf_trapno; #ifdef KDB ==== //depot/projects/smpng/sys/ia64/ia32/ia32_trap.c#3 (text+ko) ==== @@ -62,7 +62,7 @@ u_int code; int error, i, narg; - atomic_add_int(&cnt.v_syscall, 1); + PCPU_LAZY_INC(cnt.v_syscall); td = curthread; params = (caddr_t)(tf->tf_special.sp & ((1L<<32)-1)) + @@ -205,7 +205,7 @@ KASSERT(TRAPF_USERMODE(tf), ("%s: In kernel mode???", __func__)); ia64_set_fpsr(IA64_FPSR_DEFAULT); - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); td = curthread; td->td_frame = tf; ==== //depot/projects/smpng/sys/ia64/ia64/interrupt.c#28 (text+ko) ==== @@ -150,7 +150,7 @@ if (vector == CLOCK_VECTOR) {/* clock interrupt */ /* CTR0(KTR_INTR, "clock interrupt"); */ - cnt.v_intr++; + PCPU_LAZY_INC(cnt.v_intr); #ifdef EVCNT_COUNTERS clock_intr_evcnt.ev_count++; #else ==== //depot/projects/smpng/sys/ia64/ia64/trap.c#72 (text+ko) ==== @@ -332,7 +332,7 @@ user = TRAPF_USERMODE(tf) ? 1 : 0; - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); td = curthread; p = td->td_proc; @@ -896,7 +896,7 @@ code = tf->tf_scratch.gr15; args = &tf->tf_scratch.gr16; - atomic_add_int(&cnt.v_syscall, 1); + PCPU_LAZY_INC(cnt.v_syscall); td = curthread; td->td_frame = tf; ==== //depot/projects/smpng/sys/kern/kern_intr.c#66 (text+ko) ==== @@ -457,7 +457,7 @@ struct ithd *it = ih->ih_ithread; int error; - atomic_add_int(&cnt.v_intr, 1); /* one more global interrupt */ + PCPU_LAZY_INC(cnt.v_intr); CTR3(KTR_INTR, "swi_sched pid %d(%s) need=%d", it->it_td->td_proc->p_pid, it->it_td->td_proc->p_comm, it->it_need); ==== //depot/projects/smpng/sys/notes#34 (text+ko) ==== @@ -80,6 +80,13 @@ spinlock_*() changes happen. - KTR change: include __func__ along with __FILE__ and __LINE__ and display it after cpu number by default +- Cheapen global stats counters via PCPU_LAZY_INC + + cnt.v_trap + + cnt.v_syscall + + cnt.v_intr + - not implemented at all on arm, powerpc, or sparc64 + + cnt.v_soft + - fork counts? Active child branches: - jhb_intr - intr_vector stuff ==== //depot/projects/smpng/sys/powerpc/powerpc/trap.c#43 (text+ko) ==== @@ -147,7 +147,7 @@ int sig, type, user; u_int sticks, ucode; - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); td = PCPU_GET(curthread); p = td->td_proc; @@ -338,7 +338,7 @@ td = PCPU_GET(curthread); p = td->td_proc; - atomic_add_int(&cnt.v_syscall, 1); + PCPU_LAZY_INC(cnt.v_syscall); if (p->p_flag & P_SA) thread_user_enter(td); ==== //depot/projects/smpng/sys/sparc64/sparc64/trap.c#60 (text+ko) ==== @@ -240,7 +240,7 @@ trap_msg[tf->tf_type & ~T_KERNEL], (TRAPF_USERMODE(tf) ? "user" : "kernel"), rdpr(pil)); - atomic_add_int(&cnt.v_trap, 1); + PCPU_LAZY_INC(cnt.v_trap); if ((tf->tf_tstate & TSTATE_PRIV) == 0) { KASSERT(td != NULL, ("trap: curthread NULL")); @@ -510,7 +510,7 @@ p = td->td_proc; - atomic_add_int(&cnt.v_syscall, 1); + PCPU_LAZY_INC(cnt.v_syscall); narg = 0; error = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504041908.j34J8wil062517>