Date: Thu, 25 Feb 2021 18:56:59 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e7a5b3bd0589 - main - Modify lock_delay() to increase the delay time after spinning Message-ID: <202102251856.11PIuxwF020948@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e7a5b3bd058975ff3ffa346664690e54c641fc0f commit e7a5b3bd058975ff3ffa346664690e54c641fc0f Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-02-25 18:48:50 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-02-25 18:55:26 +0000 Modify lock_delay() to increase the delay time after spinning Modify lock_delay() to increase the delay time after spinning, not before. Previously we would spin at least twice instead of once. In NetApp's benchmarks this fixes a performance regression compared to FreeBSD 10, which called cpu_spinwait() directly. Reviewed By: mjg Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27331 --- sys/kern/subr_lock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index a74f7e62db4a..8b08c61715b3 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -128,10 +128,6 @@ lock_delay(struct lock_delay_arg *la) struct lock_delay_config *lc = la->config; u_short i; - la->delay <<= 1; - if (__predict_false(la->delay > lc->max)) - la->delay = lc->max; - for (i = la->delay; i > 0; i--) cpu_spinwait(); @@ -141,6 +137,10 @@ lock_delay(struct lock_delay_arg *la) if (restrict_starvation) la->delay = lc->base; } + + la->delay <<= 1; + if (__predict_false(la->delay > lc->max)) + la->delay = lc->max; } static u_int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102251856.11PIuxwF020948>