Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174420450
D60246.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D60246.diff
View Options
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -676,11 +676,27 @@
if (c_iflags & CALLOUT_TRYLOCK) {
if (__predict_false(class->lc_trylock(c_lock,
lock_status) == 0)) {
+ /*
+ * Retry after half of the precision, but not
+ * sooner than a tick from the current time.
+ * Every failure halves the precision, so the
+ * retry delay would otherwise shrink to zero.
+ * Immediate retries can starve a
+ * lower-priority lock owner on the same CPU,
+ * preventing it from running to release the
+ * lock.
+ *
+ * Use the current time because cc_lastscan may
+ * be stale by the time the lock is attempted.
+ * Keep the precision at least a tick as well,
+ * so that the retries of many contended
+ * callouts can share a timer interrupt.
+ */
cc_exec_curr(cc, direct) = NULL;
- callout_cc_add(c, cc,
- cc->cc_lastscan + c->c_precision / 2,
- qmax(c->c_precision / 2, 1), c_func, c_arg,
- (direct) ? C_DIRECT_EXEC : 0);
+ callout_cc_add(c, cc, sbinuptime() +
+ qmax(c->c_precision / 2, tick_sbt),
+ qmax(c->c_precision / 2, tick_sbt), c_func,
+ c_arg, (direct) ? C_DIRECT_EXEC : 0);
return;
}
CC_UNLOCK(cc);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 1:51 AM (4 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40128890
Default Alt Text
D60246.diff (1 KB)
Attached To
Mode
D60246: callout: enforce a minimum retry delay for CALLOUT_TRYLOCK
Attached
Detach File
Event Timeline
Log In to Comment