Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Apr 2021 12:27:34 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: 7f6157f7fd12 - main - lock_delay(9): improve interaction with restrict_starvation
Message-ID:  <202104031227.133CRYbN052030@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=7f6157f7fd12608ccb96c8a571b9352bf9968d8f

commit 7f6157f7fd12608ccb96c8a571b9352bf9968d8f
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-04-03 12:08:45 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-04-03 12:08:53 +0000

    lock_delay(9): improve interaction with restrict_starvation
    
    After e7a5b3bd058, the la->delay value was adjusted after
    being set by the starvation_limit code block, which is wrong.
    
    Reported By:    avg
    Reviewed By:    avg
    Fixes:          e7a5b3bd058
    Sponsored By:   NetApp, Inc.
    Sponsored By:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D29513
---
 sys/kern/subr_lock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c
index 8b08c61715b3..1afaa19302ed 100644
--- a/sys/kern/subr_lock.c
+++ b/sys/kern/subr_lock.c
@@ -130,17 +130,17 @@ lock_delay(struct lock_delay_arg *la)
 
 	for (i = la->delay; i > 0; i--)
 		cpu_spinwait();
-
 	la->spin_cnt += la->delay;
+
+	la->delay <<= 1;
+	if (__predict_false(la->delay > lc->max))
+		la->delay = lc->max;
+
 	if (__predict_false(la->spin_cnt > starvation_limit)) {
 		SDT_PROBE1(lock, , , starvation, la->delay);
 		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?202104031227.133CRYbN052030>