Deleted Added
full compact
kern_sx.c (181334) kern_sx.c (182914)
1/*-
2 * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
3 * Copyright (c) 2001 Jason Evans <jasone@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

35 * Priority propagation will not generally raise the priority of lock holders,
36 * so should not be relied upon in combination with sx locks.
37 */
38
39#include "opt_adaptive_sx.h"
40#include "opt_ddb.h"
41
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>
3 * Copyright (c) 2001 Jason Evans <jasone@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

35 * Priority propagation will not generally raise the priority of lock holders,
36 * so should not be relied upon in combination with sx locks.
37 */
38
39#include "opt_adaptive_sx.h"
40#include "opt_ddb.h"
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/kern/kern_sx.c 181334 2008-08-05 20:02:31Z jhb $");
43__FBSDID("$FreeBSD: head/sys/kern/kern_sx.c 182914 2008-09-10 19:13:30Z jhb $");
44
45#include <sys/param.h>
46#include <sys/ktr.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>
49#include <sys/proc.h>
50#include <sys/sleepqueue.h>
51#include <sys/sx.h>

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

206int
207_sx_slock(struct sx *sx, int opts, const char *file, int line)
208{
209 int error = 0;
210
211 MPASS(curthread != NULL);
212 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
213 ("sx_slock() of destroyed sx @ %s:%d", file, line));
44
45#include <sys/param.h>
46#include <sys/ktr.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>
49#include <sys/proc.h>
50#include <sys/sleepqueue.h>
51#include <sys/sx.h>

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

206int
207_sx_slock(struct sx *sx, int opts, const char *file, int line)
208{
209 int error = 0;
210
211 MPASS(curthread != NULL);
212 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
213 ("sx_slock() of destroyed sx @ %s:%d", file, line));
214 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line);
214 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line, NULL);
215 error = __sx_slock(sx, opts, file, line);
216 if (!error) {
217 LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line);
218 WITNESS_LOCK(&sx->lock_object, 0, file, line);
219 curthread->td_locks++;
220 }
221
222 return (error);

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

249_sx_xlock(struct sx *sx, int opts, const char *file, int line)
250{
251 int error = 0;
252
253 MPASS(curthread != NULL);
254 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
255 ("sx_xlock() of destroyed sx @ %s:%d", file, line));
256 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file,
215 error = __sx_slock(sx, opts, file, line);
216 if (!error) {
217 LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line);
218 WITNESS_LOCK(&sx->lock_object, 0, file, line);
219 curthread->td_locks++;
220 }
221
222 return (error);

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

249_sx_xlock(struct sx *sx, int opts, const char *file, int line)
250{
251 int error = 0;
252
253 MPASS(curthread != NULL);
254 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
255 ("sx_xlock() of destroyed sx @ %s:%d", file, line));
256 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file,
257 line);
257 line, NULL);
258 error = __sx_xlock(sx, curthread, opts, file, line);
259 if (!error) {
260 LOCK_LOG_LOCK("XLOCK", &sx->lock_object, 0, sx->sx_recurse,
261 file, line);
262 WITNESS_LOCK(&sx->lock_object, LOP_EXCLUSIVE, file, line);
263 curthread->td_locks++;
264 }
265

--- 782 unchanged lines hidden ---
258 error = __sx_xlock(sx, curthread, opts, file, line);
259 if (!error) {
260 LOCK_LOG_LOCK("XLOCK", &sx->lock_object, 0, sx->sx_recurse,
261 file, line);
262 WITNESS_LOCK(&sx->lock_object, LOP_EXCLUSIVE, file, line);
263 curthread->td_locks++;
264 }
265

--- 782 unchanged lines hidden ---