subr_lock.c (164231) | subr_lock.c (164246) |
---|---|
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 --- 19 unchanged lines hidden (view full) --- 28 */ 29 30/* 31 * This module holds the global variables and functions used to maintain 32 * lock_object structures. 33 */ 34 35#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 --- 19 unchanged lines hidden (view full) --- 28 */ 29 30/* 31 * This module holds the global variables and functions used to maintain 32 * lock_object structures. 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/subr_lock.c 164231 2006-11-12 23:23:38Z kmacy $"); | 36__FBSDID("$FreeBSD: head/sys/kern/subr_lock.c 164246 2006-11-13 05:41:46Z kmacy $"); |
37 38#include "opt_ddb.h" 39#include "opt_mprof.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/ktr.h> 44#include <sys/linker_set.h> --- 8 unchanged lines hidden (view full) --- 53 54CTASSERT(LOCK_CLASS_MAX == 15); 55 56struct lock_class *lock_classes[LOCK_CLASS_MAX + 1] = { 57 &lock_class_mtx_spin, 58 &lock_class_mtx_sleep, 59 &lock_class_sx, 60 &lock_class_rw, | 37 38#include "opt_ddb.h" 39#include "opt_mprof.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/ktr.h> 44#include <sys/linker_set.h> --- 8 unchanged lines hidden (view full) --- 53 54CTASSERT(LOCK_CLASS_MAX == 15); 55 56struct lock_class *lock_classes[LOCK_CLASS_MAX + 1] = { 57 &lock_class_mtx_spin, 58 &lock_class_mtx_sleep, 59 &lock_class_sx, 60 &lock_class_rw, |
61 &lock_class_lockmgr, |
|
61}; 62 63#ifdef LOCK_PROFILING 64#include <machine/cpufunc.h> 65 66SYSCTL_NODE(_debug, OID_AUTO, lock, CTLFLAG_RD, NULL, "lock debugging"); 67SYSCTL_NODE(_debug_lock, OID_AUTO, prof, CTLFLAG_RD, NULL, "lock profiling"); 68int lock_prof_enable = 0; --- 231 unchanged lines hidden (view full) --- 300 buf = atomic_fetchadd_int(&allocated_lprof_buf, 1); 301 /* Just exit if we cannot get a trace buffer */ 302 if (buf >= LPROF_HASH_SIZE) { 303 ++lock_prof_rejected; 304 return; 305 } 306 mpp->file = p; 307 mpp->line = l->lpo_lineno; | 62}; 63 64#ifdef LOCK_PROFILING 65#include <machine/cpufunc.h> 66 67SYSCTL_NODE(_debug, OID_AUTO, lock, CTLFLAG_RD, NULL, "lock debugging"); 68SYSCTL_NODE(_debug_lock, OID_AUTO, prof, CTLFLAG_RD, NULL, "lock profiling"); 69int lock_prof_enable = 0; --- 231 unchanged lines hidden (view full) --- 301 buf = atomic_fetchadd_int(&allocated_lprof_buf, 1); 302 /* Just exit if we cannot get a trace buffer */ 303 if (buf >= LPROF_HASH_SIZE) { 304 ++lock_prof_rejected; 305 return; 306 } 307 mpp->file = p; 308 mpp->line = l->lpo_lineno; |
308 mpp->name = lo->lo_name; 309 mpp->type = lo->lo_type; | |
310 mpp->namehash = l->lpo_namehash; | 309 mpp->namehash = l->lpo_namehash; |
310 mpp->type = l->lpo_type; 311 mpp->name = lo->lo_name; |
|
311 if (collision) 312 ++lock_prof_collisions; 313 /* We might have raced someone else but who cares, they'll try again next time */ 314 ++lock_prof_records; 315 } 316 LPROF_LOCK(hash); 317 mpp->cnt_wait += waittime; 318 LPROF_UNLOCK(hash); --- 44 unchanged lines hidden (view full) --- 363 /* Just exit if we cannot get a trace buffer */ 364 if (buf >= LPROF_HASH_SIZE) { 365 ++lock_prof_rejected; 366 return; 367 } 368 mpp->file = p; 369 mpp->line = l->lpo_lineno; 370 mpp->namehash = l->lpo_namehash; | 312 if (collision) 313 ++lock_prof_collisions; 314 /* We might have raced someone else but who cares, they'll try again next time */ 315 ++lock_prof_records; 316 } 317 LPROF_LOCK(hash); 318 mpp->cnt_wait += waittime; 319 LPROF_UNLOCK(hash); --- 44 unchanged lines hidden (view full) --- 364 /* Just exit if we cannot get a trace buffer */ 365 if (buf >= LPROF_HASH_SIZE) { 366 ++lock_prof_rejected; 367 return; 368 } 369 mpp->file = p; 370 mpp->line = l->lpo_lineno; 371 mpp->namehash = l->lpo_namehash; |
371 mpp->type = lo->lo_type; | 372 mpp->type = l->lpo_type; |
372 mpp->name = lo->lo_name; 373 374 if (collision) 375 ++lock_prof_collisions; 376 377 /* 378 * We might have raced someone else but who cares, 379 * they'll try again next time --- 30 unchanged lines hidden --- | 373 mpp->name = lo->lo_name; 374 375 if (collision) 376 ++lock_prof_collisions; 377 378 /* 379 * We might have raced someone else but who cares, 380 * they'll try again next time --- 30 unchanged lines hidden --- |