Deleted Added
full compact
kern_sx.c (303953) kern_sx.c (315339)
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:

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

36 * so should not be relied upon in combination with sx locks.
37 */
38
39#include "opt_ddb.h"
40#include "opt_hwpmc_hooks.h"
41#include "opt_no_adaptive_sx.h"
42
43#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:

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

36 * so should not be relied upon in combination with sx locks.
37 */
38
39#include "opt_ddb.h"
40#include "opt_hwpmc_hooks.h"
41#include "opt_no_adaptive_sx.h"
42
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: stable/11/sys/kern/kern_sx.c 303953 2016-08-11 09:28:49Z mjg $");
44__FBSDID("$FreeBSD: stable/11/sys/kern/kern_sx.c 315339 2017-03-16 00:51:24Z mjg $");
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/kdb.h>
49#include <sys/kernel.h>
50#include <sys/ktr.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>

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

143
144#ifdef ADAPTIVE_SX
145static u_int asx_retries = 10;
146static u_int asx_loops = 10000;
147static SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging");
148SYSCTL_UINT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, "");
149SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
150
45
46#include <sys/param.h>
47#include <sys/systm.h>
48#include <sys/kdb.h>
49#include <sys/kernel.h>
50#include <sys/ktr.h>
51#include <sys/lock.h>
52#include <sys/mutex.h>

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

143
144#ifdef ADAPTIVE_SX
145static u_int asx_retries = 10;
146static u_int asx_loops = 10000;
147static SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging");
148SYSCTL_UINT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, "");
149SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
150
151static struct lock_delay_config sx_delay = {
152 .initial = 1000,
153 .step = 500,
154 .min = 100,
155 .max = 5000,
156};
151static struct lock_delay_config __read_mostly sx_delay;
157
152
158SYSCTL_INT(_debug_sx, OID_AUTO, delay_initial, CTLFLAG_RW, &sx_delay.initial,
153SYSCTL_INT(_debug_sx, OID_AUTO, delay_base, CTLFLAG_RW, &sx_delay.base,
159 0, "");
154 0, "");
160SYSCTL_INT(_debug_sx, OID_AUTO, delay_step, CTLFLAG_RW, &sx_delay.step,
161 0, "");
162SYSCTL_INT(_debug_sx, OID_AUTO, delay_min, CTLFLAG_RW, &sx_delay.min,
163 0, "");
164SYSCTL_INT(_debug_sx, OID_AUTO, delay_max, CTLFLAG_RW, &sx_delay.max,
165 0, "");
166
155SYSCTL_INT(_debug_sx, OID_AUTO, delay_max, CTLFLAG_RW, &sx_delay.max,
156 0, "");
157
167static void
168sx_delay_sysinit(void *dummy)
169{
170
171 sx_delay.initial = mp_ncpus * 25;
172 sx_delay.step = (mp_ncpus * 25) / 2;
173 sx_delay.min = mp_ncpus * 5;
174 sx_delay.max = mp_ncpus * 25 * 10;
175}
176LOCK_DELAY_SYSINIT(sx_delay_sysinit);
158LOCK_DELAY_SYSINIT_DEFAULT(sx_delay);
177#endif
178
179void
180assert_sx(const struct lock_object *lock, int what)
181{
182
183 sx_assert((const struct sx *)lock, what);
184}

--- 1110 unchanged lines hidden ---
159#endif
160
161void
162assert_sx(const struct lock_object *lock, int what)
163{
164
165 sx_assert((const struct sx *)lock, what);
166}

--- 1110 unchanged lines hidden ---