SCHED_4BSD: maybe_resched() cannot schedule ast() for curthread maybe_resched() needs to schedule TDA_SCHED for curthread, but this requires taking curthread lock while owning some other thread lock. To avoid introducing the order - Use a scheduler-private TDP flag - register an unconditional TDA_SCHED_PRIV for 4BSD When an AST needs to be scheduled, i.e. the current thread must do context switch in the return to userspace path, set the flag. Then the ast handler calls ast_scheduler(), which gives the same effect as scheduling TDA_AST. The overhead is a single function call on each userspace return, for 4BSD case. Reported and tested by: pho
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
| sys/kern/sched_4bsd.c | ||
|---|---|---|
| 284 | KASSERT that td == curthread here? | |
| sys/kern/sched_4bsd.c | ||
|---|---|---|
| 284 | This is ast handler, so the invariant holds by definition. | |
| sys/kern/sched_4bsd.c | ||
|---|---|---|
| 284 |
Not quite though, ast_kclear() may call the AST handler. I'm aware it does not do that here, today. | |