Page MenuHomeFreeBSD

Handle multiple clock ticks in sched_clock()
ClosedPublic

Authored by jeff on Sun, Dec 1, 8:42 PM.

Details

Summary

This was one optimization from https://github.com/freebsd/freebsd/compare/master...jwroberson:schedlock

It is relatively straightforward in ULE to handle a long set of idle ticks without looping. I did not attempt to do so for 4bsd. This also gives an early return for idlethread because it does not need interactivity or priority adjustments. It does run the percent cpu calculator.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jeff created this revision.Sun, Dec 1, 8:42 PM
jeff edited the summary of this revision. (Show Details)Sun, Dec 1, 8:44 PM
jeff added reviewers: mav, kib, jhb, markj, mjg.
jeff set the repository for this revision to rS FreeBSD src repository.
kib accepted this revision.Sun, Dec 1, 9:07 PM
This revision is now accepted and ready to land.Sun, Dec 1, 9:07 PM
mav accepted this revision.Sun, Dec 1, 10:42 PM
imp added a comment.Mon, Dec 2, 6:21 AM

Looks same to me. The only macro difference is dropping the idle thread check. Is that intended? Is so, is it safe?

sys/kern/sched_ule.c
2468 ↗(On Diff #65105)

Why did you drop the idle thread check,?

markj accepted this revision.Mon, Dec 2, 4:49 PM
markj added inline comments.
sys/kern/sched_ule.c
2445 ↗(On Diff #65105)

This comment is slightly wrong, we don't update the index once per tick.

2468 ↗(On Diff #65105)

It is moved earlier. The change is a no-op since PRI_BASE(td->td_pri_class) != PRI_TIMESHARE for an idle thread.

This revision was automatically updated to reflect the committed changes.