diff options
author | jhb <jhb@FreeBSD.org> | 2002-03-08 18:55:59 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-03-08 18:55:59 +0000 |
commit | d07be68dbad5208e7db903d1d0fc7efc1231b1b5 (patch) | |
tree | bad18a8afeb48f111a1c9a712fbde782c43537fa /sys | |
parent | 01c622cea59151954c2429b00169633b25f87233 (diff) | |
download | FreeBSD-src-d07be68dbad5208e7db903d1d0fc7efc1231b1b5.zip FreeBSD-src-d07be68dbad5208e7db903d1d0fc7efc1231b1b5.tar.gz |
Read KTR_CPU into a temporary variable so that we use a consistent value
for both the cpumask check and the cpu entry field w/o needing to use
a critical section.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_ktr.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index 9896ed8..0686aa2 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -120,8 +120,8 @@ ktr_tracepoint(u_int mask, const char *format, u_long arg1, u_long arg2, { struct ktr_entry *entry; int newindex, saveindex; - critical_t savecrit; struct thread *td; + int cpu; #ifdef KTR_EXTEND va_list ap; #endif @@ -133,19 +133,16 @@ ktr_tracepoint(u_int mask, const char *format, u_long arg1, u_long arg2, td = curthread; if (td->td_inktr) return; - savecrit = cpu_critical_enter(); - if (((1 << KTR_CPU) & ktr_cpumask) == 0) { - cpu_critical_exit(savecrit); + cpu = KTR_CPU; + if (((1 << cpu) & ktr_cpumask) == 0) return; - } td->td_inktr++; do { saveindex = ktr_idx; newindex = (saveindex + 1) & (KTR_ENTRIES - 1); } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); entry = &ktr_buf[saveindex]; - entry->ktr_cpu = KTR_CPU; - cpu_critical_exit(savecrit); + entry->ktr_cpu = cpu; nanotime(&entry->ktr_tv); #ifdef KTR_EXTEND entry->ktr_filename = filename; |