Page MenuHomeFreeBSD

Running the sched_preempt handler in a critical section causes us to acquire the scheduler lock twice in a row. It is not necessary since interrupts aredisabled already in this path.
ClosedPublic

Authored by jeff on Dec 1 2019, 8:35 PM.
Tags
None
Referenced Files
F103986392: D22623.id65102.diff
Mon, Dec 2, 1:29 AM
Unknown Object (File)
Sat, Nov 30, 12:57 AM
Unknown Object (File)
Mon, Nov 25, 11:21 AM
Unknown Object (File)
Sun, Nov 24, 9:17 AM
Unknown Object (File)
Oct 26 2024, 11:14 AM
Unknown Object (File)
Oct 2 2024, 9:23 PM
Unknown Object (File)
Sep 30 2024, 11:10 PM
Unknown Object (File)
Sep 28 2024, 6:48 AM
Subscribers

Details

Summary

I am working on reducing the diffs in my scheduler locking change branch. https://github.com/freebsd/freebsd/compare/master...jwroberson:schedlock

This is a small change that allows the direct switch optimization in sched_preempt() to work as intended. Otherwise we grab the sched lock, set owepreempt, drop the sched lock, critical_exit, acquire the sched lock, see owepreempt, then switch.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27873
Build 26044: arc lint + arc unit

Event Timeline

jeff retitled this revision from Running the sched_preempt handler in a critical section causes us to acquire the scheduler lock twice in a row. It is not necessary since interrupts are disabled already in this path. to Running the sched_preempt handler in a critical section causes us to acquire the scheduler lock twice in a row. It is not necessary since interrupts aredisabled already in this path..Dec 1 2019, 8:37 PM
jeff edited the summary of this revision. (Show Details)
jeff added reviewers: jhb, kib, mav, markj.
jeff set the repository for this revision to rS FreeBSD src repository - subversion.
kib added inline comments.
sys/x86/x86/mp_x86.c
1275

I must note that having oldframe and td_intr_frame correct in larger region is sometimes useful. I do not mind much about intr_nesting_level.

This revision is now accepted and ready to land.Dec 1 2019, 8:58 PM
sys/x86/x86/mp_x86.c
1275

I can move it back out. I just wanted to be precise about what the different handlers required.

markj added inline comments.
sys/x86/x86/mp_x86.c
1275

I've found td_intr_frame from preempted threads useful as well, FWIW.

sys/x86/x86/mp_x86.c
1275

I will move this code back in the committed patch after testing.

I suspect the original critical section was only for hardclock() (wanted all of hardclock() to finish before preempting to run softclock()) and that sched_preempt ended up under it due to inertia.