Post Reply

Kernel Wakelocks and You

OP sishgupta

24th January 2012, 02:22 PM   |  #1  
OP Senior Member
Flag Toronto
Thanks Meter: 109
 
253 posts
Join Date:Joined: Dec 2011
More
I am opening this thread to talk about kernel Wakelocks. It's a branch of this discussion in the Franco's Kernel thread.

Hopefully we can research what a lot of these wakelocks are and find ways of minimizing them in order to increase the efficiency (and reduce power consumption) on our devices.

What is a Wakelock?
A wakelock is a software method for applications to control the power state of your device. The purpose of a wakelock is in its name, to lock your device in an awake state keeping the CPU running and preventing it from entering Deep Sleep (Think of a music app or video player). A wakelock can also cause your device to turn on (think syncs or notifications).

A poorly coded application can acquire a wakelock and not release it, causing your device to remain on.

A partial wakelock means the CPU is ON, but the screen is OFF.
A full wakelock means the CPU and Screen are ON. (we don't really need to worry about this)
Sources:
http://developer.android.com/referen...erManager.html
http://developer.android.com/referen....WakeLock.html

How to help:
Install BetterBatteryStats which will show you what the wakelocks are on your device.
If you don't know what a specific wakelock is doing. Google it. Don't just google the wakelock name verbatim. Use part of it. They are usually logically named. But most often they are shortened or turned into acronyms (there are so many in IT) which makes them cyptic.

Kernel wakelocks are low level/hardware wakelocks from the kernel. We can only reduce these by modifying the kernel or reducing the usage of a certain feature of the kernel. By researching these we can improve the battery consumption and performance of the Kernel.

Partial wakelocks are wakelocks from apps. These can be reduced by uninstalling or disabling features in software. We can talk about those here too though it shouldn't be the focus as the answer will be "Uninstall/Disable feature X and talk to the app author". Preferably we should talk about partial wakelocks from Google services like maps and latitude.


Quote:
Originally Posted by psycho2097

I think it would benefit a lot of noobs here,me included if someone started a thread compiling a list of the known wakelocks and how to avoid or get rid of them. For the life of me I can't figure out mipi_link, alarm_rtc,musb_autosuspend and I have no idea how to remove wlan_rx and vbus_tuna_otg. I would highly appreciate some help on these.

Sent from my Galaxy Nexus

wlan_rx is wireless LAN receive. Turn off wifi.

musb_autosuspend_wake_lock im pretty sure is a kernel powermanagement method to turn off power to the micro usb port and have any attached devices be placed in a power suspend mode. Probably most useful for the USB OTG support on this port.

alarm_rtc is Real-time clock alarm. It isn't the alarm to wake you up, tho it could be used by that. It's more like a scheduler on your phone, to make sure it is not sleeping when an application needs it. "AlarmManager is a universal process that MANY apps use to update time, push you notifications, etc. In most cases, it is a necessity; in other cases, you should really check it out and disable/uninstall things that have invoked it too much."
Sources:
http://developer.android.com/referen...rmManager.html
https://github.com/asksven/BetterBat...i/AlarmManager

vbus_tuna_otg sounds like virtual bus for USB OTG devices. According to Franco this wakelock occurs when your "device [is] attached to the USB." From this I would take it to mean that if your GNex is attached to a computer via USB you will see this wakelock.

mipi_link stands for Mobile Industry Processor Interface but I am unsure of what this does specifically. From googling it it seems highly related to the cameras. Maybe its how we can see a live feed of the camera from the device.
Sources:
http://en.wikipedia.org/wiki/Mobile_...ssor_Interface

PowerManagerService is the kernel wakelock that is a container for all of the partial wakelocks on the device.
Sources:
https://github.com/asksven/BetterBat...ManagerService

AudioOut_1 AudioOut is used to play notification and system sounds. Putting your device on silent will make this go away.
Sources:
https://github.com/asksven/BetterBat...iki/AudioOut_1

Revisions:
2012.01.24 - Added "what is a wakelock" section
2012.01.24 - Initial Post
Last edited by sishgupta; 25th January 2012 at 02:05 PM.
The Following 33 Users Say Thank You to sishgupta For This Useful Post: [ View ]
24th January 2012, 03:33 PM   |  #2  
psycho2097's Avatar
Senior Member
Flag Raleigh
Thanks Meter: 155
 
928 posts
Join Date:Joined: Nov 2010
Donate to Me
More
Awesome. theres also a wiki in the betterbatterystats website that explains some of the more known wakelocks, nonetheless, these will be very helpful to a new user.

https://github.com/asksven/BetterBat...se/wiki/_pages

Also, the betterbatterystats thread at XDA has some intro level info.

edit: I just realised you already posted individual links.
Last edited by psycho2097; 24th January 2012 at 03:35 PM.
24th January 2012, 03:46 PM   |  #3  
Senior Member
Flag Central Jersey
Thanks Meter: 19
 
186 posts
Join Date:Joined: Jan 2012
More
These wake locks are beginning to piss me off really. Pardon my frustration. Check the screen shots of better battery stats. I don't have touch sounds checked or nfc enabled. I did use media player to play music in the train. I have these wake locks all over the place and haven't found any solution yet. Anyone any help much appreciated.this is all with stock rooted running Jame bond kernel. Stock kernel was better. Using default UV settings and some profiles.








Sent from my Galaxy Nexus using XDA App
24th January 2012, 04:00 PM   |  #4  
OP Senior Member
Flag Toronto
Thanks Meter: 109
 
253 posts
Join Date:Joined: Dec 2011
More
Quote:
Originally Posted by vick1377

These wake locks are beginning to piss me off really. Pardon my frustration. Check the screen shots of better battery stats. I don't have touch sounds checked or nfc enabled. I did use media player to play music in the train. I have these wake locks all over the place and haven't found any solution yet. Anyone any help much appreciated.this is all with stock rooted running Jame bond kernel. Stock kernel was better. Using default UV settings and some profiles.

Sent from my Galaxy Nexus using XDA App

Wakelocks are a normal part of the system. You can't get rid of them, but you can minimize the unnecessary ones for sure.

Yeah its unfortunate that the NFC wakelock occurs even with it disabled. Thankfully its very minimal.

The Audioout_1 wakelock im sure is all audio events. Like notifications and perhaps even music playing. Nothing you can do here.

Modem_USB im guessing is your USB Tethering for data? If you turned that off you might get rid of them as they don't even show up on mine.

Basically I would just be focusing on wakelocks that are proportionately higher than the others. If most wakelocks are 2-3 minutes after a full days use but you see a one or more holding wakelocks that are in the double digits, check those out.
The Following 2 Users Say Thank You to sishgupta For This Useful Post: [ View ]
24th January 2012, 04:21 PM   |  #5  
Senior Member
Flag Central Jersey
Thanks Meter: 19
 
186 posts
Join Date:Joined: Jan 2012
More
Thank you for a quick response. Where do I turn off USB tethering which I don't have? As you see some of partial locks are very high. Also once you stop using per say audio player or mp3 player shouldn't that audio out wake lock go down or disappear. Off topic question when I flashed Jame bond kernel did I have to wipe cache and dalvik cache?

Are there some apps which can tell which apps are bringing these locks? I can post alogcat logs later from PC as I can't attach from phone as it only allows screenshots from gallery

Sent from my Galaxy Nexus using XDA App
24th January 2012, 05:26 PM   |  #6  
OP Senior Member
Flag Toronto
Thanks Meter: 109
 
253 posts
Join Date:Joined: Dec 2011
More
Quote:
Originally Posted by vick1377

Thank you for a quick response. Where do I turn off USB tethering which I don't have? As you see some of partial locks are very high. Also once you stop using per say audio player or mp3 player shouldn't that audio out wake lock go down or disappear. Off topic question when I flashed Jame bond kernel did I have to wipe cache and dalvik cache?

Are there some apps which can tell which apps are bringing these locks? I can post alogcat logs later from PC as I can't attach from phone as it only allows screenshots from gallery

Sent from my Galaxy Nexus using XDA App

Settings > More... > Tethering & Portable Hotspot > Make sure everything here is unchecked. You can only check/uncheck USB Tethering if the device is plugged in.

If you stop playing audio I would assume the audioout_1 wakelock to reduce significantly. If you look at your screenshot you see Android Media Player holding a wakelock for 23 minutes, and Audioout_1 for 24 minutes.
So I am assuming that if you didnt listen to any audio, audioout_1 would just say about 1 minute. You may never get it to dissappear fully even if the device is muted. This is something you'd want to try on your own and report back. Remember we're doing research together I'm not doing it for you

As for wiping cache and dalvik after flashing a kernel. Franco says you do not have to. So personally I don't. It definitely doesn't hurt other than wasting time. If you do flash a ROM though you must wipe both caches.

Finally you need to decide how much you want to reduce wakelocks. Like if you are listening to music there is nothing wrong with having your device awake. It shouldn't kill THAT much battery. Esp if you clock down to 350mhz.
Last edited by sishgupta; 24th January 2012 at 07:53 PM.
The Following 3 Users Say Thank You to sishgupta For This Useful Post: [ View ]
24th January 2012, 06:20 PM   |  #7  
Thracks's Avatar
Senior Member
Flag Toronto
Thanks Meter: 68
 
222 posts
Join Date:Joined: May 2010
More
You can dramatically reduce the AudioOut wakelock by disabling the following in SETTINGS > SOUNDS:

Touch sounds, dial pad touch tones and screen lock sound.

Disabling these three options eliminated my problem completely.

As for myself:
MIPI_LINK continues to be the #1 destroyer of my battery life, regardless of what ROM or kernel I flash. Even just flashing the ROM, wiping the battery stats and then leaving the phone on my desk untouched for 12+ hours can cut 10-20% off my battery life.

It's ridiculous. There is absolutely something wrong with the battery drain on the Galaxy Nexus, but some people have it, and others don't.
24th January 2012, 06:48 PM   |  #8  
Senior Member
Flag Central Jersey
Thanks Meter: 19
 
186 posts
Join Date:Joined: Jan 2012
More
Wake locks
Quote:
Originally Posted by sishgupta

Settings > More... > Tethering & Portable Hotspot > Make sure everything here is unchecked. You can only check/uncheck USB Tethering if the device is plugged in.

If you stop playing audio I would assume the audioout_1 wakelock to reduce significantly. If you look at your screenshot you see Android Media Player holding a wakelock for 23 minutes, and Audioout_1 for 24 minutes.
So I am assuming that if you didnt listen to any audio, audioout_1 would just say about 1 minute. You may never get it to dissappear fully even if the device is muted. This is something you'd want to try on your own and report back. Remember we're doing research together I'm not doing it for you

As for wiping cache and dalvik after flashing a kernel. Franco says you do not have to. So personally I don't. It definitely doesn't hurt other than wasting time. If you do flash a ROM though you must wipe both caches.

Finally you need to device how much you want to reduce wakelocks. Like if you are listening to music there is nothing wrong with having your device awake. It shouldn't kill THAT much battery. Esp if you clock down to 350mhz.

Opening this thread is the best thing. Can't appreciate enough. So, I always have the phone in vibrate mode but turned to silent mode and checked the better battery stats, the audioout_1 still there but I think it's showing still the same as 25 minutes or so and but % has gone down to 6-7% from 10% and above. Regardless the time is not increasing even though it the wake lock is still there. I'm wondering if it doesn't refresh until after fully charge/unplugged. I checked both kernel and partial wake locks with option since unplugged and since charged. What I will do next is drain the battery fully few times too since it's an extended battery I got last week?

One thing for sure I was getting better battery life with stock rooted rom and stock kernel with some setcpu profiles. I made all the nandroid, titanium backups, what I will do next is flash the stock kernel and monitor the results and report back here for comparison. After then I will be super tempted to flash 4.0.3 franco's ROM and nightly kernel . I'm debating to wait for OTA 4.0.3 or custom ROM. I'm honestly not at all happy with jame bond kernel in terms of battery life. Can you also suggest some good radios to flash? Part of the problem could be the phone toggling between 3g and 4g connection. Most places I do get consistently but sometimes it switches back to 3g. Flashing new radio might improve the signal strength to keep it consistent on 4g so that no toggling required.

Absolutely we are doing this research together no doubt and you are helping a tons

---------- Post added at 01:48 PM ---------- Previous post was at 01:24 PM ----------

Regarding USB tethering, did you mean plugged via outlet or via data cable connecting to computer? When connected via charger cable (not data/charger cable that came with it) to AC outlet, I see usb tethering disable and grayed out. I think you probably meant via data cable connecting to USB port of computer. I will do that tonight once I get home and check to see if these usb related wake locks go away or reduce.
24th January 2012, 06:51 PM   |  #9  
psycho2097's Avatar
Senior Member
Flag Raleigh
Thanks Meter: 155
 
928 posts
Join Date:Joined: Nov 2010
Donate to Me
More
Quote:
Originally Posted by sishgupta

Wakelocks are a normal part of the system. You can't get rid of them, but you can minimize the unnecessary ones for sure.

Yeah its unfortunate that the NFC wakelock occurs even with it disabled. Thankfully its very minimal.

The Audioout_1 wakelock im sure is all audio events. Like notifications and perhaps even music playing. Nothing you can do here.

Modem_USB im guessing is your USB Tethering for data? If you turned that off you might get rid of them as they don't even show up on mine.

Basically I would just be focusing on wakelocks that are proportionately higher than the others. If most wakelocks are 2-3 minutes after a full days use but you see a one or more holding wakelocks that are in the double digits, check those out.

You are right in the audio wakelock, it happens only when you play something. Its not bad, its not something you should be trying to reduce.
Its not faulty, it happens only when anything is playd, screen lock sounds will significantly increase this, because that does cause a faulty wakelock.


Quote:
Originally Posted by sishgupta

Settings > More... > Tethering & Portable Hotspot > Make sure everything here is unchecked. You can only check/uncheck USB Tethering if the device is plugged in.

If you stop playing audio I would assume the audioout_1 wakelock to reduce significantly. If you look at your screenshot you see Android Media Player holding a wakelock for 23 minutes, and Audioout_1 for 24 minutes.
So I am assuming that if you didnt listen to any audio, audioout_1 would just say about 1 minute. You may never get it to dissappear fully even if the device is muted. This is something you'd want to try on your own and report back. Remember we're doing research together I'm not doing it for you

As for wiping cache and dalvik after flashing a kernel. Franco says you do not have to. So personally I don't. It definitely doesn't hurt other than wasting time. If you do flash a ROM though you must wipe both caches.

Finally you need to device how much you want to reduce wakelocks. Like if you are listening to music there is nothing wrong with having your device awake. It shouldn't kill THAT much battery. Esp if you clock down to 350mhz.

again, hes right here, if you listen to music continuously for a hour or so, and use only the volume key long-press to skip tracks, the gnex uses an extremely low power DAC to play music, takes only around 60-70 ma. You could play for ages without losing significant battery.

I disagree on the cache clean process tho. I have flashed a lot of roms/kernels, and not observing the correct procedure can cause significant problems.Most kernels use different tweaks, mods and scripts to make your system perform better, and its highly possible for one of the tweaks to just stay over and conflict with your new kernel, causing heavy wakelocks. When that happens, your best bet is wiping anyways. So better safe than sorry.

Quote:
Originally Posted by Thracks

You can dramatically reduce the AudioOut wakelock by disabling the following in SETTINGS > SOUNDS:

Touch sounds, dial pad touch tones and screen lock sound.

Disabling these three options eliminated my problem completely.

As for myself:
MIPI_LINK continues to be the #1 destroyer of my battery life, regardless of what ROM or kernel I flash. Even just flashing the ROM, wiping the battery stats and then leaving the phone on my desk untouched for 12+ hours can cut 10-20% off my battery life.

It's ridiculous. There is absolutely something wrong with the battery drain on the Galaxy Nexus, but some people have it, and others don't.

There is nothing wrong. The thing wrong here is that people have misconceptions. DONT CLEAR BATT STATS. It has been confirmed to not change anything. That was old battery tech. After flashing a new rom, i always do 2-3 charge cycles. after a new kernel, drain till empty then charge and use. I may be wrong, but I have never experienced any issues by this method. I regularly get 1% per 1-2 hrs depending on wifi/data on standby. Even 1% per 4hrs in wifi &data off.

Quote:
Originally Posted by vick1377

Opening this thread is the best thing. Can't appreciate enough. So, I always have the phone in vibrate mode but turned to silent mode and checked the better battery stats, the audioout_1 still there but I think it's showing still the same as 25 minutes or so and but % has gone down to 6-7% from 10% and above. Regardless the time is not increasing even though it the wake lock is still there. I'm wondering if it doesn't refresh until after fully charge/unplugged. I checked both kernel and partial wake locks with option since unplugged and since charged. What I will do next is drain the battery fully few times too since it's an extended battery I got last week?

One thing for sure I was getting better battery life with stock rooted rom and stock kernel with some setcpu profiles. I made all the nandroid, titanium backups, what I will do next is flash the stock kernel and monitor the results and report back here for comparison. After then I will be super tempted to flash 4.0.3 franco's ROM and nightly kernel . I'm debating to wait for OTA 4.0.3 or custom ROM. I'm honestly not at all happy with jame bond kernel in terms of battery life. Can you also suggest some good radios to flash? Part of the problem could be the phone toggling between 3g and 4g connection. Most places I do get consistently but sometimes it switches back to 3g. Flashing new radio might improve the signal strength to keep it consistent on 4g so that no toggling required.

Absolutely we are doing this research together no doubt and you are helping a tons

You are correct in assuming it doesnt reset till fully cahrged. When fully charged, the <since charged> counter resets, however, any time you plug it in, the <since unplugged> counter resets.

I dont know whether u hav LTE/GSM, but kk6 does wonders for me in GSM. For example yest i was in a factory from 8am-3pm, with no signal time showing 70%. Absolutely no signal inside factory. I mean , like my whole battry bar is red, almost. My Captivate would be dead by 3pm. The nexus still had 72% juice left when i reached home at 3:30pm, that too with 40 mins screen on.
Also, 4.0.3 may have some issues, but thats y we r here, thats y we bought a nexus, to play with the latest and greatest.

THIS
IS
NEXUS.
The Following 2 Users Say Thank You to psycho2097 For This Useful Post: [ View ]
24th January 2012, 07:01 PM   |  #10  
OP Senior Member
Flag Toronto
Thanks Meter: 109
 
253 posts
Join Date:Joined: Dec 2011
More
Quote:
Originally Posted by psycho2097

I disagree on the cache clean process tho. I have flashed a lot of roms/kernels, and not observing the correct procedure can cause significant problems.Most kernels use different tweaks, mods and scripts to make your system perform better, and its highly possible for one of the tweaks to just stay over and conflict with your new kernel, causing heavy wakelocks. When that happens, your best bet is wiping anyways. So better safe than sorry.

I'm just repeating what Franco said. He was very adamant about the kernel having nothing to do with the caches.

Quote:
Originally Posted by psycho2097

DONT CLEAR BATT STATS. It has been confirmed to not change anything.

Correct. here is more information regarding this
http://www.xda-developers.com/androi...-battery-life/


Quote:
Originally Posted by psycho2097

After flashing a new rom, i always do 2-3 charge cycles. after a new kernel, drain till empty then charge and use.

IMHO there is no point to this. What would this achieve?

Quote:
Originally Posted by psycho2097

kk6 does wonders for me in GSM.

XXKL1 is out. Check it out, its very good. Link in my sig.

Quote:
Originally Posted by psycho2097

Also, 4.0.3 may have some issues, but thats y we r here, thats y we bought a nexus, to play with the latest and greatest.

THIS
IS
NEXUS.

Quoted for truth

The Following User Says Thank You to sishgupta For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
battery, kernel, wakelock
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy Nexus General by ThreadRank