kern_rwlock.c (189074) | kern_rwlock.c (189846) |
---|---|
1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 189074 2009-02-26 15:51:54Z ed $"); | 35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 189846 2009-03-15 08:03:54Z jeff $"); |
36 37#include "opt_ddb.h" 38#include "opt_no_adaptive_rwlocks.h" 39 40#include <sys/param.h> 41#include <sys/ktr.h> 42#include <sys/kernel.h> 43#include <sys/lock.h> --- 233 unchanged lines hidden (view full) --- 277_rw_rlock(struct rwlock *rw, const char *file, int line) 278{ 279 struct turnstile *ts; 280#ifdef ADAPTIVE_RWLOCKS 281 volatile struct thread *owner; 282 int spintries = 0; 283 int i; 284#endif | 36 37#include "opt_ddb.h" 38#include "opt_no_adaptive_rwlocks.h" 39 40#include <sys/param.h> 41#include <sys/ktr.h> 42#include <sys/kernel.h> 43#include <sys/lock.h> --- 233 unchanged lines hidden (view full) --- 277_rw_rlock(struct rwlock *rw, const char *file, int line) 278{ 279 struct turnstile *ts; 280#ifdef ADAPTIVE_RWLOCKS 281 volatile struct thread *owner; 282 int spintries = 0; 283 int i; 284#endif |
285#ifdef LOCK_PROFILING |
|
285 uint64_t waittime = 0; 286 int contested = 0; | 286 uint64_t waittime = 0; 287 int contested = 0; |
288#endif |
|
287 uintptr_t v; 288 289 KASSERT(rw->rw_lock != RW_DESTROYED, 290 ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); 291 KASSERT(rw_wowner(rw) != curthread, 292 ("%s (%s): wlock already held @ %s:%d", __func__, 293 rw->lock_object.lo_name, file, line)); 294 WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); --- 284 unchanged lines hidden (view full) --- 579_rw_wlock_hard(struct rwlock *rw, uintptr_t tid, const char *file, int line) 580{ 581 struct turnstile *ts; 582#ifdef ADAPTIVE_RWLOCKS 583 volatile struct thread *owner; 584 int spintries = 0; 585 int i; 586#endif | 289 uintptr_t v; 290 291 KASSERT(rw->rw_lock != RW_DESTROYED, 292 ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); 293 KASSERT(rw_wowner(rw) != curthread, 294 ("%s (%s): wlock already held @ %s:%d", __func__, 295 rw->lock_object.lo_name, file, line)); 296 WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER, file, line, NULL); --- 284 unchanged lines hidden (view full) --- 581_rw_wlock_hard(struct rwlock *rw, uintptr_t tid, const char *file, int line) 582{ 583 struct turnstile *ts; 584#ifdef ADAPTIVE_RWLOCKS 585 volatile struct thread *owner; 586 int spintries = 0; 587 int i; 588#endif |
587 uint64_t waittime = 0; | |
588 uintptr_t v, x; | 589 uintptr_t v, x; |
590#ifdef LOCK_PROFILING 591 uint64_t waittime = 0; |
|
589 int contested = 0; | 592 int contested = 0; |
593#endif |
|
590 591 if (rw_wlocked(rw)) { 592 KASSERT(rw->lock_object.lo_flags & RW_RECURSE, 593 ("%s: recursing but non-recursive rw %s @ %s:%d\n", 594 __func__, rw->lock_object.lo_name, file, line)); 595 rw->rw_recurse++; 596 if (LOCK_LOG_TEST(&rw->lock_object, 0)) 597 CTR2(KTR_LOCK, "%s: %p recursing", __func__, rw); --- 440 unchanged lines hidden --- | 594 595 if (rw_wlocked(rw)) { 596 KASSERT(rw->lock_object.lo_flags & RW_RECURSE, 597 ("%s: recursing but non-recursive rw %s @ %s:%d\n", 598 __func__, rw->lock_object.lo_name, file, line)); 599 rw->rw_recurse++; 600 if (LOCK_LOG_TEST(&rw->lock_object, 0)) 601 CTR2(KTR_LOCK, "%s: %p recursing", __func__, rw); --- 440 unchanged lines hidden --- |