On Sat, Aug 07, 2010 at 03:00:48AM -0700, david@lang.hm wrote:But isn't the whole point of wakelocks to permit developers to easily and efficiently identify which processes are "unimportant" at a given point in time, thereby allowing them to be ignored? I understand your position -- you believe that PM-driving applications should be written to remain idle any time that they aren't doing something "important". This is a reasonable position to take, but it is also reasonable to justify your position. Exactly -why- is this better? Here is my evaluation: o You might not need suspend blockers. This is not totally clear, and won't be until you actually build a system based on your design. o You will be requiring that developers of PM-driving applications deal with more code that must be very carefully coded and validated. This requirement forces the expenditure of lots of people time to save a very small amount of very inexpensive memory (that occupied by the suspend-blocker code). Keep in mind that there was a similar decision in the -rt kernel. One choice was similar to your proposal: all code paths must call schedule() sufficiently frequently. The other choice was to allow almost all code paths to be preempted, which resembles suspend blockers (preempt_disable() being analogous to acquiring a suspend blocker, and preempt_enable() being analogous to releasing a suspend blocker). Then as now, there was much debate. The choice then was preemption. One big reason was that the choice of preemption reduced the amount of real-time-aware code from the entire kernel to only that part of the kernel that disabled preemption, which turned out to greatly simplify the job of meeting aggressive scheduling-latency goals. This experience does add some serious precedent against your position. So, what do you believe is different in the energy-efficiency case? Agreed, and the focus is on how one decides which applications need to be considered. After all, the activity of a highly optimized audio-playback application looks exactly like that of a stupid polling application -- they both periodically consume some CPU. But this is something that you and the Android guys are actually agreeing about. You are only arguing about exactly what mechanism should be used to make this determination. The Android guys want suspend blockers, and you want to extend cgroups. So I believe that the next step for you is to implement your approach so that it can be compared in terms of energy efficiency, code size, intrusiveness, performance, and compatibility with existing code. The difference is that the CPU stays active in the drive spin down case -- if the drive turns out to be needed, the CPU can spin it up. The added complication in the suspend case is that the CPU goes away, so that you must more carefully plan for all of the power-up cases. We already covered the differences between suspend and idle, now didn't we? ;-) Thanx, Paul --
