Deleted Added
full compact
kern_mutex.c (244582) kern_mutex.c (252212)
1/*-
2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

29 * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $
30 */
31
32/*
33 * Machine independent bits of mutex implementation.
34 */
35
36#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

29 * and BSDI $Id: synch_machdep.c,v 2.3.2.39 2000/04/27 03:10:25 cp Exp $
30 */
31
32/*
33 * Machine independent bits of mutex implementation.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/kern/kern_mutex.c 244582 2012-12-22 09:37:34Z attilio $");
37__FBSDID("$FreeBSD: head/sys/kern/kern_mutex.c 252212 2013-06-25 20:23:08Z jhb $");
38
39#include "opt_adaptive_mutexes.h"
40#include "opt_ddb.h"
41#include "opt_global.h"
42#include "opt_hwpmc_hooks.h"
43#include "opt_kdtrace.h"
44#include "opt_sched.h"
45

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

238
239 m = mtxlock2mtx(c);
240
241 KASSERT(m->mtx_lock != MTX_DESTROYED,
242 ("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
243 KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,
244 ("mtx_unlock() of spin mutex %s @ %s:%d", m->lock_object.lo_name,
245 file, line));
38
39#include "opt_adaptive_mutexes.h"
40#include "opt_ddb.h"
41#include "opt_global.h"
42#include "opt_hwpmc_hooks.h"
43#include "opt_kdtrace.h"
44#include "opt_sched.h"
45

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

238
239 m = mtxlock2mtx(c);
240
241 KASSERT(m->mtx_lock != MTX_DESTROYED,
242 ("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
243 KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,
244 ("mtx_unlock() of spin mutex %s @ %s:%d", m->lock_object.lo_name,
245 file, line));
246 curthread->td_locks--;
247 WITNESS_UNLOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line);
248 LOCK_LOG_LOCK("UNLOCK", &m->lock_object, opts, m->mtx_recurse, file,
249 line);
250 mtx_assert(m, MA_OWNED);
251
252 if (m->mtx_recurse == 0)
253 LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_UNLOCK_RELEASE, m);
254 __mtx_unlock(m, curthread, opts, file, line);
246 WITNESS_UNLOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line);
247 LOCK_LOG_LOCK("UNLOCK", &m->lock_object, opts, m->mtx_recurse, file,
248 line);
249 mtx_assert(m, MA_OWNED);
250
251 if (m->mtx_recurse == 0)
252 LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_UNLOCK_RELEASE, m);
253 __mtx_unlock(m, curthread, opts, file, line);
254 curthread->td_locks--;
255}
256
257void
258__mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file,
259 int line)
260{
261 struct mtx *m;
262

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

889 if ((opts & MTX_NOWITNESS) == 0)
890 flags |= LO_WITNESS;
891 if (opts & MTX_DUPOK)
892 flags |= LO_DUPOK;
893 if (opts & MTX_NOPROFILE)
894 flags |= LO_NOPROFILE;
895
896 /* Initialize mutex. */
255}
256
257void
258__mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file,
259 int line)
260{
261 struct mtx *m;
262

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

889 if ((opts & MTX_NOWITNESS) == 0)
890 flags |= LO_WITNESS;
891 if (opts & MTX_DUPOK)
892 flags |= LO_DUPOK;
893 if (opts & MTX_NOPROFILE)
894 flags |= LO_NOPROFILE;
895
896 /* Initialize mutex. */
897 lock_init(&m->lock_object, class, name, type, flags);
898
897 m->mtx_lock = MTX_UNOWNED;
898 m->mtx_recurse = 0;
899 m->mtx_lock = MTX_UNOWNED;
900 m->mtx_recurse = 0;
899
900 lock_init(&m->lock_object, class, name, type, flags);
901}
902
903/*
904 * Remove lock `m' from all_mtx queue. We don't allow MTX_QUIET to be
905 * passed in as a flag here because if the corresponding mtx_init() was
906 * called with MTX_QUIET set, then it will already be set in the mutex's
907 * flags.
908 */

--- 93 unchanged lines hidden ---
901}
902
903/*
904 * Remove lock `m' from all_mtx queue. We don't allow MTX_QUIET to be
905 * passed in as a flag here because if the corresponding mtx_init() was
906 * called with MTX_QUIET set, then it will already be set in the mutex's
907 * flags.
908 */

--- 93 unchanged lines hidden ---