LWN.net Logo

Hand-waving about a phased sleep

Hand-waving about a phased sleep

Posted Jan 7, 2009 17:55 UTC (Wed) by johntb86 (subscriber, #53897)
In reply to: Hand-waving about a phased sleep by BrucePerens
Parent article: Btrfs aims for the mainline

That's an interesting idea, but as far as I know to wake up the processor you'd need an IPI, so it's not exactly cheap. You'd also need to create a timer interrupt to wake up the processor if it's not woken up by some other method, so this could become a pretty expensive way to have the processor do no work for a while.


(Log in to post comments)

Hand-waving about a phased sleep

Posted Jan 7, 2009 18:26 UTC (Wed) by BrucePerens (guest, #2510) [Link]

Perhaps we need hardware support to make this work properly. A timed halt instruction, or a low-level atomic primitive that can wake a processor waiting for an address.

Hand-waving about a phased sleep

Posted Jan 7, 2009 21:29 UTC (Wed) by jlokier (guest, #52227) [Link]

x86 does have a primitive to wait on an address: monitor/mwait.
It waits until the monitored location is modified by another processor.

I read that it's a bit slow for this sort of thing.

In principle, if it were fast (and it could be with MESI caches),
it would be very well suited to replace all spinning waits.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds