Deleted Added
full compact
kern_lock.c (251326) kern_lock.c (252212)
1/*-
2 * Copyright (c) 2008 Attilio Rao <attilio@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 */
28
29#include "opt_adaptive_lockmgrs.h"
30#include "opt_ddb.h"
31#include "opt_hwpmc_hooks.h"
32#include "opt_kdtrace.h"
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Attilio Rao <attilio@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 */
28
29#include "opt_adaptive_lockmgrs.h"
30#include "opt_ddb.h"
31#include "opt_hwpmc_hooks.h"
32#include "opt_kdtrace.h"
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/kern/kern_lock.c 251326 2013-06-03 17:41:11Z jhb $");
35__FBSDID("$FreeBSD: head/sys/kern/kern_lock.c 252212 2013-06-25 20:23:08Z jhb $");
36
37#include <sys/param.h>
38#include <sys/kdb.h>
39#include <sys/ktr.h>
40#include <sys/lock.h>
41#include <sys/lock_profile.h>
42#include <sys/lockmgr.h>
43#include <sys/mutex.h>

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

233
234static __inline int
235wakeupshlk(struct lock *lk, const char *file, int line)
236{
237 uintptr_t v, x;
238 u_int realexslp;
239 int queue, wakeup_swapper;
240
36
37#include <sys/param.h>
38#include <sys/kdb.h>
39#include <sys/ktr.h>
40#include <sys/lock.h>
41#include <sys/lock_profile.h>
42#include <sys/lockmgr.h>
43#include <sys/mutex.h>

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

233
234static __inline int
235wakeupshlk(struct lock *lk, const char *file, int line)
236{
237 uintptr_t v, x;
238 u_int realexslp;
239 int queue, wakeup_swapper;
240
241 TD_LOCKS_DEC(curthread);
242 TD_SLOCKS_DEC(curthread);
243 WITNESS_UNLOCK(&lk->lock_object, 0, file, line);
244 LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, file, line);
245
246 wakeup_swapper = 0;
247 for (;;) {
248 x = lk->lk_lock;
249
250 /*

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

334 "exclusive");
335 wakeup_swapper |= sleepq_broadcast(&lk->lock_object, SLEEPQ_LK,
336 0, queue);
337 sleepq_release(&lk->lock_object);
338 break;
339 }
340
341 lock_profile_release_lock(&lk->lock_object);
241 WITNESS_UNLOCK(&lk->lock_object, 0, file, line);
242 LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, file, line);
243
244 wakeup_swapper = 0;
245 for (;;) {
246 x = lk->lk_lock;
247
248 /*

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

332 "exclusive");
333 wakeup_swapper |= sleepq_broadcast(&lk->lock_object, SLEEPQ_LK,
334 0, queue);
335 sleepq_release(&lk->lock_object);
336 break;
337 }
338
339 lock_profile_release_lock(&lk->lock_object);
340 TD_LOCKS_DEC(curthread);
341 TD_SLOCKS_DEC(curthread);
342 return (wakeup_swapper);
343}
344
345static void
346assert_lockmgr(const struct lock_object *lock, int what)
347{
348
349 panic("lockmgr locks do not support assertions");

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

392 if ((flags & LK_NOWITNESS) == 0)
393 iflags |= LO_WITNESS;
394 if (flags & LK_QUIET)
395 iflags |= LO_QUIET;
396 if (flags & LK_IS_VNODE)
397 iflags |= LO_IS_VNODE;
398 iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE);
399
342 return (wakeup_swapper);
343}
344
345static void
346assert_lockmgr(const struct lock_object *lock, int what)
347{
348
349 panic("lockmgr locks do not support assertions");

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

392 if ((flags & LK_NOWITNESS) == 0)
393 iflags |= LO_WITNESS;
394 if (flags & LK_QUIET)
395 iflags |= LO_QUIET;
396 if (flags & LK_IS_VNODE)
397 iflags |= LO_IS_VNODE;
398 iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE);
399
400 lock_init(&lk->lock_object, &lock_class_lockmgr, wmesg, NULL, iflags);
400 lk->lk_lock = LK_UNLOCKED;
401 lk->lk_recurse = 0;
402 lk->lk_exslpfail = 0;
403 lk->lk_timo = timo;
404 lk->lk_pri = pri;
401 lk->lk_lock = LK_UNLOCKED;
402 lk->lk_recurse = 0;
403 lk->lk_exslpfail = 0;
404 lk->lk_timo = timo;
405 lk->lk_pri = pri;
405 lock_init(&lk->lock_object, &lock_class_lockmgr, wmesg, NULL, iflags);
406 STACK_ZERO(lk);
407}
408
409/*
410 * XXX: Gross hacks to manipulate external lock flags after
411 * initialization. Used for certain vnode and buf locks.
412 */
413void

--- 1092 unchanged lines hidden ---
406 STACK_ZERO(lk);
407}
408
409/*
410 * XXX: Gross hacks to manipulate external lock flags after
411 * initialization. Used for certain vnode and buf locks.
412 */
413void

--- 1092 unchanged lines hidden ---