Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170891800
D37594.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
D37594.diff
View Options
diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c
--- a/sys/kern/kern_clocksource.c
+++ b/sys/kern/kern_clocksource.c
@@ -175,6 +175,9 @@
state = DPCPU_PTR(timerstate);
+ /* make sure the time is properly aligned */
+ state->nexthard -= state->nexthard % tick_sbt;
+
runs = 0;
while (now >= state->nexthard) {
state->nexthard += tick_sbt;
@@ -317,7 +320,7 @@
next = &nexttick;
now = sbinuptime();
if (periodic)
- *next = now + timerperiod;
+ *next = now - (now % timerperiod) + timerperiod;
else
*next = -1; /* Next tick is not scheduled yet. */
state->now = now;
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
@@ -902,10 +902,14 @@
to_sbt = DPCPU_GET(hardclocktime);
spinlock_exit();
#endif
- if (cold && to_sbt == 0)
+ if (__predict_false(cold && to_sbt == 0)) {
to_sbt = sbinuptime();
+ to_sbt -= to_sbt % tick_sbt;
+ }
if ((flags & C_HARDCLOCK) == 0)
to_sbt += tick_sbt;
+
+ sbt -= sbt % tick_sbt; /* align timeout */
} else
to_sbt = sbinuptime();
if (SBT_MAX - to_sbt < sbt)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 8, 8:57 AM (8 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38509105
Default Alt Text
D37594.diff (1 KB)
Attached To
Mode
D37594: callout(9): When using the C_HARDCLOCK flag, ensure the target time is aligned to "tick_sbt"
Attached
Detach File
Event Timeline
Log In to Comment