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
This commit is contained in:
parent
22267215d6
commit
e7a5b3bd05
@ -128,10 +128,6 @@ lock_delay(struct lock_delay_arg *la)
|
|||||||
struct lock_delay_config *lc = la->config;
|
struct lock_delay_config *lc = la->config;
|
||||||
u_short i;
|
u_short i;
|
||||||
|
|
||||||
la->delay <<= 1;
|
|
||||||
if (__predict_false(la->delay > lc->max))
|
|
||||||
la->delay = lc->max;
|
|
||||||
|
|
||||||
for (i = la->delay; i > 0; i--)
|
for (i = la->delay; i > 0; i--)
|
||||||
cpu_spinwait();
|
cpu_spinwait();
|
||||||
|
|
||||||
@ -141,6 +137,10 @@ lock_delay(struct lock_delay_arg *la)
|
|||||||
if (restrict_starvation)
|
if (restrict_starvation)
|
||||||
la->delay = lc->base;
|
la->delay = lc->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
la->delay <<= 1;
|
||||||
|
if (__predict_false(la->delay > lc->max))
|
||||||
|
la->delay = lc->max;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u_int
|
static u_int
|
||||||
|
Loading…
Reference in New Issue
Block a user