kern_rwlock.c (192853) | kern_rwlock.c (193035) |
---|---|
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 192853 2009-05-26 20:28:22Z sson $"); | 35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 193035 2009-05-29 13:56:34Z jhb $"); |
36 37#include "opt_ddb.h" 38#include "opt_kdtrace.h" 39#include "opt_no_adaptive_rwlocks.h" 40 41#include <sys/param.h> 42#include <sys/ktr.h> 43#include <sys/kernel.h> --- 363 unchanged lines hidden (view full) --- 407 if (RW_CAN_READ(v)) { 408 turnstile_cancel(ts); 409 cpu_spinwait(); 410 continue; 411 } 412 413#ifdef ADAPTIVE_RWLOCKS 414 /* | 36 37#include "opt_ddb.h" 38#include "opt_kdtrace.h" 39#include "opt_no_adaptive_rwlocks.h" 40 41#include <sys/param.h> 42#include <sys/ktr.h> 43#include <sys/kernel.h> --- 363 unchanged lines hidden (view full) --- 407 if (RW_CAN_READ(v)) { 408 turnstile_cancel(ts); 409 cpu_spinwait(); 410 continue; 411 } 412 413#ifdef ADAPTIVE_RWLOCKS 414 /* |
415 * If the current owner of the lock is executing on another 416 * CPU quit the hard path and try to spin. | 415 * The current lock owner might have started executing 416 * on another CPU (or the lock could have changed 417 * owners) while we were waiting on the turnstile 418 * chain lock. If so, drop the turnstile lock and try 419 * again. |
417 */ 418 if ((v & RW_LOCK_READ) == 0) { 419 owner = (struct thread *)RW_OWNER(v); 420 if (TD_IS_RUNNING(owner)) { 421 turnstile_cancel(ts); 422 cpu_spinwait(); 423 continue; 424 } --- 284 unchanged lines hidden (view full) --- 709 continue; 710 } 711#endif 712 ts = turnstile_trywait(&rw->lock_object); 713 v = rw->rw_lock; 714 715#ifdef ADAPTIVE_RWLOCKS 716 /* | 420 */ 421 if ((v & RW_LOCK_READ) == 0) { 422 owner = (struct thread *)RW_OWNER(v); 423 if (TD_IS_RUNNING(owner)) { 424 turnstile_cancel(ts); 425 cpu_spinwait(); 426 continue; 427 } --- 284 unchanged lines hidden (view full) --- 712 continue; 713 } 714#endif 715 ts = turnstile_trywait(&rw->lock_object); 716 v = rw->rw_lock; 717 718#ifdef ADAPTIVE_RWLOCKS 719 /* |
717 * If the current owner of the lock is executing on another 718 * CPU quit the hard path and try to spin. | 720 * The current lock owner might have started executing 721 * on another CPU (or the lock could have changed 722 * owners) while we were waiting on the turnstile 723 * chain lock. If so, drop the turnstile lock and try 724 * again. |
719 */ 720 if (!(v & RW_LOCK_READ)) { 721 owner = (struct thread *)RW_OWNER(v); 722 if (TD_IS_RUNNING(owner)) { 723 turnstile_cancel(ts); 724 cpu_spinwait(); 725 continue; 726 } --- 398 unchanged lines hidden --- | 725 */ 726 if (!(v & RW_LOCK_READ)) { 727 owner = (struct thread *)RW_OWNER(v); 728 if (TD_IS_RUNNING(owner)) { 729 turnstile_cancel(ts); 730 cpu_spinwait(); 731 continue; 732 } --- 398 unchanged lines hidden --- |