aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_lock.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2018-04-08 16:34:10 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2018-04-08 16:34:10 +0000
commita045941bd2a73aafd6755461e61cd6a6e963f670 (patch)
treee99081184fe382b1ae1c5b0e9cdd4176317a7a41 /sys/kern/subr_lock.c
parent9f56e37dbe2ce3daa66b68ca3691c699ba3a13fe (diff)
downloadsrc-a045941bd2a73aafd6755461e61cd6a6e963f670.tar.gz
src-a045941bd2a73aafd6755461e61cd6a6e963f670.zip
locks: tweak backoff a little bit
Previous limits were chosen when locking primitives had spurious lock accesses. Flipping the starting point to 1 (or rather 2 as the first call shifts it) provides a modest win when mild contention is seen while not hurting worse cases. Tested on a bunch of one, two and four socket old and new systems (Westmere, Skylake, Threadreaper and others) by doing concurrent page faults, buildkernel/buildworld and other stuff (although not all systems got all the tests). Another thing is the upper limit. It is semi-arbitrarily chosen as it was getting out of hand for slightly less small systems (e.g. a 128-thread one). Note that backoff is fundamentally a speculative bandaid and this change just makes it fit a little bit better. It remains completely oblivious to the hardware topology or the contention pattern. This is being experimented with.
Notes
Notes: svn path=/head/; revision=332285
Diffstat (limited to 'sys/kern/subr_lock.c')
-rw-r--r--sys/kern/subr_lock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index 01b82fe23d48..4ac4e6bf00d6 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -156,8 +156,10 @@ void
lock_delay_default_init(struct lock_delay_config *lc)
{
- lc->base = lock_roundup_2(mp_ncpus) / 4;
- lc->max = lc->base * 1024;
+ lc->base = 1;
+ lc->max = lock_roundup_2(mp_ncpus) * 256;
+ if (lc->max > 32678)
+ lc->max = 32678;
}
#ifdef DDB