Page MenuHomeFreeBSD

sched: spit sched_ap_entry() out of sched_throw()
ClosedPublic

Authored by kevans on Nov 4 2021, 12:38 AM.

Details

Summary

sched_throw() can no longer take a NULL thread, APs enter through
sched_ap_entry() instead. This completely removes branching in the
common case. No functional change intended.

Diff Detail

Repository
rG 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

kib added inline comments.
sys/kern/sched_4bsd.c
1707

I would group this MPASS together with td != NULL

This revision is now accepted and ready to land.Nov 4 2021, 12:44 AM
markj added inline comments.
sys/kern/sched_ule.c
2986

Maybe explain why: it's important to not enable interrupts until the CPU is running in a threaded context.

sys/sys/sched.h
104

Keep them sorted?

sys/kern/sched_ule.c
2986

Sure, how about (with wrapping fixed):

/*
 * sched_throw_grab() chooses a thread from the queue to switch to
 * next.  It returns with the tdq lock dropped in a spinlock section to
 * keep interrupts disabled until the CPU is running in a proper threaded
 * context.
 */
sys/kern/sched_ule.c
2986

Seems ok to me.

This revision was automatically updated to reflect the committed changes.
kevans marked 2 inline comments as done.