7 ms·
The Android bug seems to explain that this was a bug in Android <= Gingerbread: https://code.google.com/p/android/issues/detail?id=42265 https://code.google.co
by mmastrac 14y ago
The Android bug seems to explain that this was a bug in Android <= Gingerbread:
https://code.google.com/p/android/issues/detail?id=42265 https://code.google.com/p/android/issues/detail?id=42265
A comment by Elliott Hughes on the bug:
"i don't know why you think this is anything to do with dalvik (or libcore). neither touches /dev/random. java.util.Random is just a PRNG seeded from the clock. java.util.SecureRandom uses /dev/urandom.
"what version of Android are you reporting this against? i think there was a bug once upon a time. <checks> oh, yeah, <= gingerbread was broken. > gingerbread should be fine."
- bjustin 14y agoA later comment says it affects versions through JB: Users are reporting this issue up through Jelly Bean / 4.2 - my specific information is against 4.2. I don't believe this issue was solved in gingerbread.
- AndrewDucker 14y agoWe're seeing lots of people say "It's faster", but without some actual benchmarks I'm sceptical to say the least.
- DannyBee 14y agoThis comment is wrong. As someone later shows, putting inotify waits on /dev/random shows nothing is opening it.
- mjg59 14y agoThere are in-kernel consumers of entropy (such as for aslr) that wouldn't show up as /dev/random opens. Reading urandom will deplete the available entropy, but won't block - however, anything relying on actual entropy availability will then block until entropy is repopulated. So if entropy_avail is ever hitting 0, there's some vague plausibility that you could have some slowdowns. But honestly, it doesn't seem likely.
- DannyBee 14y agoI could buy this, but i'd be surprised if it was in the very small percentage of code that is in android but not regular kernel. Past that, android workloads are certainly different, but i'd still think you'd see something outside of android.
- vidarh 14y agoIt appears to be wrong that there's anything that reads /dev/random, yes. It is still correct that there are reports of latency reductions across the board. Whether or not they are real or placebo, or if they are real but have other causes (such as reboots) is another matter. But it's too easy to just dismiss this. I tried it on one of my tablets too, and din't reboot, and subjectively it feels substantially snappier - previously the UI would often freeze up long enough for me to get ANR dialogues, and the recommended solution for that tablet model is a full factory reset when it start being persistently slow. That does not mean that I'm sure the effect is real. Nor does it mean that it has to have anything to do with /dev/random.
- m0th87 14y agoI was following this last night because it's hilarious. Last I checked, there were three likely causes for the "performance boost" (or some combination thereof): 1) You have to restart the phone to activate the patch. Many users might not have restarted in ages, and this alone would cause a good performance gain. 2) The patch is keeping the CPU from idling by constantly writing to /dev/random. This gives you better performance at the detriment of battery life. 3) Placebo effect.
- StavrosK 14y agoI'm also running this. I haven't noticed much of an improvement. The original poster says he spent hours debugging it, but hasn't posted a single shred of evidence on the process or the result.
- zackelan 14y agoYeah, users' reports of its effectiveness seem to vary wildly. My suspicion is that it depends heavily on the CPU governor [1] a device uses. Some will see that process running once a second, and keep the CPU at or near max frequency 100% of the time. Others will back down more quickly and you won't see much of a benefit, and still others were probably running at max frequency even before the change, so it wouldn't have much of an effect on them either. [1]: http://androidforums.com/xperia-mini-all-things-root/513426-android-cpu-governors-explained.html http://androidforums.com/xperia-mini-all-things-root/513426-...
- StavrosK 14y agoMaybe. I symlinked /dev/urandom to /dev/random, so I wouldn't have noticed a difference if that were a case, as I didn't.
- juliano_q 14y agoI installed the patch and my CPU frequencies looks like the same, they are not scaling to max all the time. That said it is hard to notice any significant improvement after installing it.
- 89a 14y agoPretty funny it was an issue in any version of the OS at all. Amateur hour
- ajross 14y agoI hate to say it, but this kind of bad analysis is just endemic in the Android modding world. There's no technical leadership at the top (the AOSP people are, for the most part, silent except occasionally in bug reports like this), so people just throw whatever hack they want onto forums filled with even-less-clueful folks and things go viral. If you tried this on a "real" Linux project you'd be laughed at. Where's the test showing latency improvement? Hell, there isn't even any identifaction of any code at all that reads from /dev/random (and of course it appears there is none). It seems a little unfair, but frankly I blame Google for this mess. They refuse to run AOSP as a "project", which leaves the AOSP-derived projects a big soup of developers with no clear meritocracy. Some bits (Cyanogenmod) are really quite good. But the stuff on XDA is probably 60% useless junk.
- angryasian 14y agoA google engineer already came out and said this does nothing for ics and up.
- ajross 14y agoNot my point at all. If AOSP worked like, say, the kernel (or KDE, or gcc, or any other big project) this "fix" would have been submitted to and vetted by a functioning group of experts who would have immediately said "Dude, no." and it would have died silently. No such thing exists with AOSP. Google does their development internally. External patch submissions (if acknowledged at all) end up appearing in a usable release only months after the fact. So the poor excited hacker here (who, let's be clear, really didn't do anything wrong other than, well, being wrong) had nowhere to post a fix somewhere where it would be useful to people. So s/he threw it up on XDA with all the other junk, and we're now having this discussion.
- jrockway 14y agoDo "real" open source projects issue releases after every patch? I've recently submitted a small patch to Android and it showed up in the repository immediately. While there is some development done in secret, not everything is. You can git blame and email the developers and they will probably talk to you. (My experience is perhaps different because I have a @google.com email address, but the developers are actually nice people that do value open source, as far as I can tell.)