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

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

24 * SUCH DAMAGE.
25 */
26
27/*
28 * Machine independent bits of reader/writer lock implementation.
29 */
30
31#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

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

24 * SUCH DAMAGE.
25 */
26
27/*
28 * Machine independent bits of reader/writer lock implementation.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/11/sys/kern/kern_rwlock.c 303953 2016-08-11 09:28:49Z mjg $");
32__FBSDID("$FreeBSD: stable/11/sys/kern/kern_rwlock.c 315339 2017-03-16 00:51:24Z mjg $");
33
34#include "opt_ddb.h"
35#include "opt_hwpmc_hooks.h"
36#include "opt_no_adaptive_rwlocks.h"
37
38#include <sys/param.h>
39#include <sys/kdb.h>
40#include <sys/ktr.h>

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

95#ifdef ADAPTIVE_RWLOCKS
96static int rowner_retries = 10;
97static int rowner_loops = 10000;
98static SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL,
99 "rwlock debugging");
100SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, "");
101SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, "");
102
33
34#include "opt_ddb.h"
35#include "opt_hwpmc_hooks.h"
36#include "opt_no_adaptive_rwlocks.h"
37
38#include <sys/param.h>
39#include <sys/kdb.h>
40#include <sys/ktr.h>

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

95#ifdef ADAPTIVE_RWLOCKS
96static int rowner_retries = 10;
97static int rowner_loops = 10000;
98static SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL,
99 "rwlock debugging");
100SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, "");
101SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, "");
102
103static struct lock_delay_config rw_delay = {
104 .initial = 1000,
105 .step = 500,
106 .min = 100,
107 .max = 5000,
108};
103static struct lock_delay_config __read_mostly rw_delay;
109
104
110SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_initial, CTLFLAG_RW, &rw_delay.initial,
105SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_base, CTLFLAG_RW, &rw_delay.base,
111 0, "");
106 0, "");
112SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_step, CTLFLAG_RW, &rw_delay.step,
113 0, "");
114SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_min, CTLFLAG_RW, &rw_delay.min,
115 0, "");
116SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_max, CTLFLAG_RW, &rw_delay.max,
117 0, "");
118
107SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_max, CTLFLAG_RW, &rw_delay.max,
108 0, "");
109
119static void
120rw_delay_sysinit(void *dummy)
121{
122
123 rw_delay.initial = mp_ncpus * 25;
124 rw_delay.step = (mp_ncpus * 25) / 2;
125 rw_delay.min = mp_ncpus * 5;
126 rw_delay.max = mp_ncpus * 25 * 10;
127}
128LOCK_DELAY_SYSINIT(rw_delay_sysinit);
110LOCK_DELAY_SYSINIT_DEFAULT(rw_delay);
129#endif
130
131/*
132 * Return a pointer to the owning thread if the lock is write-locked or
133 * NULL if the lock is unlocked or read-locked.
134 */
135#define rw_wowner(rw) \
136 ((rw)->rw_lock & RW_LOCK_READ ? NULL : \

--- 1175 unchanged lines hidden ---
111#endif
112
113/*
114 * Return a pointer to the owning thread if the lock is write-locked or
115 * NULL if the lock is unlocked or read-locked.
116 */
117#define rw_wowner(rw) \
118 ((rw)->rw_lock & RW_LOCK_READ ? NULL : \

--- 1175 unchanged lines hidden ---