Use PCPU_LAZY_INC() for cnt.v_{intr,trap,syscalls} rather than atomic

operations in some places and simple non-per CPU math in others.
This commit is contained in:
John Baldwin 2005-04-12 23:18:54 +00:00
parent 9fd0669542
commit aa9aa68d2f
16 changed files with 25 additions and 25 deletions

View File

@ -139,7 +139,7 @@ interrupt(a0, a1, a2, framep)
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 @@ static void
alpha_clock_interrupt(struct trapframe *framep)
{
cnt.v_intr++;
PCPU_LAZY_INC(cnt.v_intr);
#ifdef EVCNT_COUNTERS
clock_intr_evcnt.ev_count++;
#else

View File

@ -295,7 +295,7 @@ trap(a0, a1, a2, entry, framep)
* 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 @@ syscall(code, framep)
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;

View File

@ -167,7 +167,7 @@ intr_execute_handlers(struct intsrc *isrc, struct intrframe *iframe)
* processed too.
*/
(*isrc->is_count)++;
cnt.v_intr++;
PCPU_LAZY_INC(cnt.v_intr);
it = isrc->is_ithread;
if (it == NULL)

View File

@ -162,7 +162,7 @@ trap(frame)
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

View File

@ -106,7 +106,7 @@ ia32_syscall(struct trapframe frame)
* 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;

View File

@ -251,7 +251,7 @@ data_abort_handler(trapframe_t *tf)
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 @@ prefetch_abort_handler(trapframe_t *tf)
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 @@ syscall(struct thread *td, trapframe_t *frame, u_int32_t insn)
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);

View File

@ -185,7 +185,7 @@ undefinedinstruction(trapframe_t *frame)
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;

View File

@ -167,7 +167,7 @@ intr_execute_handlers(struct intsrc *isrc, struct intrframe *iframe)
* processed too.
*/
(*isrc->is_count)++;
cnt.v_intr++;
PCPU_LAZY_INC(cnt.v_intr);
it = isrc->is_ithread;
if (it == NULL)

View File

@ -180,7 +180,7 @@ trap(frame)
static int lastalert = 0;
#endif
atomic_add_int(&cnt.v_trap, 1);
PCPU_LAZY_INC(cnt.v_trap);
type = frame.tf_trapno;
#ifdef KDB

View File

@ -62,7 +62,7 @@ ia32_syscall(struct trapframe *tf)
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 @@ ia32_trap(int vector, struct trapframe *tf)
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;

View File

@ -152,7 +152,7 @@ interrupt(u_int64_t vector, struct trapframe *tf)
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

View File

@ -332,7 +332,7 @@ trap(int vector, struct trapframe *tf)
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 @@ syscall(struct trapframe *tf)
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;

View File

@ -457,7 +457,7 @@ swi_sched(void *cookie, int flags)
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);

View File

@ -147,7 +147,7 @@ trap(struct trapframe *frame)
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 @@ syscall(struct trapframe *frame)
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);

View File

@ -147,7 +147,7 @@ trap(struct trapframe *frame)
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 @@ syscall(struct trapframe *frame)
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);

View File

@ -240,7 +240,7 @@ trap(struct trapframe *tf)
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 @@ syscall(struct trapframe *tf)
p = td->td_proc;
atomic_add_int(&cnt.v_syscall, 1);
PCPU_LAZY_INC(cnt.v_syscall);
narg = 0;
error = 0;