DragonFly kernel List (threaded) for 2007-09
DragonFly BSD
DragonFly kernel List (threaded) for 2007-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Detangle lwkt_switch() and the idle thread and consolidate sleep variables


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Sat, 01 Sep 2007 19:32:10 +0200

hey,

our lwkt_switch()/cpu_idle() code is kind of interwoven. additionally, there are several variables on which we need to spin if there are runnable threads: mplock and tokens.

This makes it kind of hard to implement a idle loop which suspends the CPU, using MONITOR/MWAIT.

A quick explanation for those not aware how MONITOR/MWAIT works: you can "arm" the monitoring hardware in modern intel CPUs using MONITOR. Any write to this address (the size is implementation specific, probably 64 bytes) will trigger the monitoring hardware. A following MWAIT will place the CPU into a power saving state until the monitoring hardware gets triggered. There can be other causes for a trigger, for instance interrupts.

So what I'd like to have is a single variable on which I can MWAIT, even if there are runnable threads. This could be either the mplock, or maybe a per-CPU variable, being set if any token the CPU is waiting on gets released.

Is something like this architecturally possible? I'd really love to use my laptop, but right now it is still running too hot.

cheers
 simon



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]