From owner-dev-commits-src-all@freebsd.org Thu Feb 25 18:56:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDDF056D110; Thu, 25 Feb 2021 18:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dmhpz60s0z3FTF; Thu, 25 Feb 2021 18:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C18A01CC13; Thu, 25 Feb 2021 18:56:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11PIuxW5020949; Thu, 25 Feb 2021 18:56:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11PIuxwF020948; Thu, 25 Feb 2021 18:56:59 GMT (envelope-from git) Date: Thu, 25 Feb 2021 18:56:59 GMT Message-Id: <202102251856.11PIuxwF020948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: e7a5b3bd0589 - main - Modify lock_delay() to increase the delay time after spinning MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7a5b3bd058975ff3ffa346664690e54c641fc0f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2021 18:56:59 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e7a5b3bd058975ff3ffa346664690e54c641fc0f commit e7a5b3bd058975ff3ffa346664690e54c641fc0f Author: Edward Tomasz Napierala AuthorDate: 2021-02-25 18:48:50 +0000 Commit: Edward Tomasz Napierala 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