Improving performance on multiprocessor systems
Phase 1
Branches: yamt-splraiseipl, newlock2
MT safe sleep / wakeup
Modern locking primitives
| Area | Task | Responsible | Progress |
|---|---|---|---|
| Synchronisation primitives | Implement new primitives. | thorpej, ad | Complete |
| Implement splraiseipl() | yamt | Complete | |
| Implement profiling tool (lockstat). | ad | Complete | |
| Process state | Reorganise, lock and document necessary process and LWP state. | ad | Complete |
| Make signals MT and sleep safe. | ad | Complete | Make ktrace MT and sleep safe | ad | Complete |
| Branch work | |||
| Complete, test and merge newlock2 branch. | All | Complete | |
| Implement MD stubs on architectures other than x86. | All | Complete |
Phase 2
Branches: yamt-idlelwp, vmlocking
Fewer side effects when using locks
Allow MT safe and unsafe code to coexist
VM system and VFS made MT safe
| Area | Task | Responsible | Progress |
|---|---|---|---|
| Interrupts | |||
| Implement threaded soft interrupts. | ad | Complete | |
| Primitives | |||
| Retire spinlockmgr(). | ad | Complete | |
| Make lockmgr() use mutexes for interlocking. | ad | Complete | |
| Make callout_init() take a flags argument and push the kernel lock acquire down into softclock(). | ad | Complete | |
| Implement a generic cross-call facility | ad | Complete | |
| Scheduler | Increase the number of available priority levels, maybe defining: user, system, real time and interrupt. | ad | Complete |
| Implement one idle LWP per CPU, and reduce cpu_switch() to cpu_switchto() | yamt, all | Complete | |
| Remove MD setrunqueue()/remrunqueue(). | yamt | Complete | |
| Support per-CPU run queues to reduce contention and facilitate bound LWPs. | ad, rmind | Complete | |
| Implement priority inheritance for turnstiles. | yamt | Complete | |
| Device drivers | Put wrappers around the devsw entry points that will take the kernel lock for MT unsafe drivers. | ad | Complete |
| Misc | Make x86 use MONITOR/MWAIT to obviate need for IPIs when waking other CPUs. | yamt | Complete |
| VM system | In UVM, replace simple_lock and lockmgr locks with mutexes and rwlocks. | ad | Complete | Profile and improve concurrency. | ad | Complete | Implement per-CPU caching allocator. | ad, yamt | Complete |
| Replace locks in other components, eg: pools, malloc, vmem. | ad | Complete | |
| In the PMAP modules, replace simple_lock and lockmgr locks. | ad | Complete | |
| Solve any documented races and and locking problems in UVM. | ad, yamt | Complete | |
| VFS | Make the ufs/tmpfs/other file systems MT safe | ad | Complete |
| Push the kernel_lock back into VOP_ wrappers and file operation sets | ad | Complete | |
| Update the VFS locking scheme to be more MT friendly where necessary | ad | Complete |
Phase 3
Branches: HEAD
Work to complete before release of NetBSD 5.0
| Area | Task | Responsible | Progress |
|---|---|---|---|
| Compat code | Nuke the stackgap | dsl | Complete |
| Update compat code to be MT safe, or nuke where appropriate | ad, dsl | Complete | |
| Device drivers | Make kqueue MT safe | ad | Complete |
| Overhaul select/poll to use per thread state, and to cache state | ad, rmind | Complete | |
| Networking | Remove kernel_lock from Unix domain sockets | ad | Complete |
| Allow network soft interrupt handlers to block. | ad | Complete | |
| Process state | Join interrupt and process context locks, so that the only remaining interrupt context locks are on objects intimately related to the scheduler (e.g. LWPs, run queues). Requires threaded soft interrupts, and allowing network ISRs to block. | ad | Complete |
| Full per-LWP stats (eg rusage). | ad | Complete | |
| POSIX threads | Implement adaptive mutexes | ad | Complete |
| VFS | Improve concurrency in the file system name cache | ad | Complete |
Future work
Branches: HEAD
| Area | Task | Responsible | Progress |
|---|---|---|---|
| Primitives | Replace uses of simple locks and lockmgr() locks throughout the kernel. | All | Underway |
| Implement a patent free alternative to RCU (read, copy, update) | ad | Underway | |
| Device drivers | Allow interrupt handlers to be individually marked as MT safe / unsafe. | ? | None |
| Lock the SCSIPI subsystem. | ? | None | |
| Lock the ATA subsystem. | ? | None | |
| Lock RAIDframe. | ? | None | |
| Profiling | Make lockstat use timecounters for reporting, so that results are accurate for sleep locks | ? | None |
| Make event counters lockless. | ? | None | |
| Convert remaining global counters into event counters. | ? | None |