Deleted Added
full compact
kern_rwlock.c (177912) kern_rwlock.c (179334)
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 177912 2008-04-04 10:00:46Z jeff $");
35__FBSDID("$FreeBSD: head/sys/kern/kern_rwlock.c 179334 2008-05-27 00:27:50Z attilio $");
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>

--- 602 unchanged lines hidden (view full) ---

646 if (TD_IS_RUNNING(owner)) {
647 turnstile_cancel(ts);
648 cpu_spinwait();
649 continue;
650 }
651 }
652#endif
653 /*
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>

--- 602 unchanged lines hidden (view full) ---

646 if (TD_IS_RUNNING(owner)) {
647 turnstile_cancel(ts);
648 cpu_spinwait();
649 continue;
650 }
651 }
652#endif
653 /*
654 * If the lock was released while waiting for the turnstile
655 * chain lock retry.
654 * Check for the waiters flags about this rwlock.
655 * If the lock was released, without maintain any pending
656 * waiters queue, simply try to acquire it.
657 * If a pending waiters queue is present, claim the lock
658 * ownership and maintain the pending queue.
656 */
657 x = v & (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER);
658 if ((v & ~x) == RW_UNLOCKED) {
659 x &= ~RW_LOCK_WRITE_SPINNER;
660 if (atomic_cmpset_acq_ptr(&rw->rw_lock, v, tid | x)) {
661 if (x)
662 turnstile_claim(ts);
663 else

--- 365 unchanged lines hidden ---
659 */
660 x = v & (RW_LOCK_WAITERS | RW_LOCK_WRITE_SPINNER);
661 if ((v & ~x) == RW_UNLOCKED) {
662 x &= ~RW_LOCK_WRITE_SPINNER;
663 if (atomic_cmpset_acq_ptr(&rw->rw_lock, v, tid | x)) {
664 if (x)
665 turnstile_claim(ts);
666 else

--- 365 unchanged lines hidden ---