lock_delay(9): improve interaction with restrict_starvation

After e7a5b3bd05, 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:		e7a5b3bd05
Sponsored By:	NetApp, Inc.
Sponsored By:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D29513
This commit is contained in:
Edward Tomasz Napierala 2021-04-03 13:08:45 +01:00
parent bfd8b9b826
commit 7f6157f7fd

View File

@ -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