yashsingh1/xdaforums huggingface dataset:
[Redmi Note 2 Android Development] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] internal sdcard presentation is now fixed in new boot.img. Had to revert back a couple of steps since MIUI has too much legacy code from pre-Lollipop:(

If you flash the latest image, backup what is dear to you on emulated sdcard first.

You may get some odd remnant folders relating to the internal emulated sdcard after a reboot.

Go to /data/media and you should find three folders: "0", legacy and obb. Delete anything else you find in there as well as checking that you do not have a /data/media/0/0 folder. Delete that if it exists. Reboot and everything should display normally again.
[Redmi Note 2 Android Development] DarthJabba9:
You mean

everything

, other than those three directories? I can see a lot of files there!
[Redmi Note 2 Android Development] insestito:
not work on CM 12.1
[Redmi Note 2 Android Development] jajk:
[MENTION=1928598]insestito[/MENTION] Thanks for letting me know.

[MENTION=5850987]DarthJabba9[/MENTION] Do the files look like everything you previously had on sdcard? You can move them to /data/media/0 to restore them or delete them if you already have taken care of restoring the files.

Whatever you do to /data/media ripples through to all the symlinks to that location. It is not normally advisable to access data/media directly but in this case it is the right thing to do to get rid of orphaned folders.
[Redmi Note 2 Android Development] Dnxss:
Thanks for your repply jajk :). Actually im loving this boot imagen, and I'm not looking for all to be working, I'm telling this because every 50 seconds or 70, the Phone frezees for about 2 seconds and then the app that I mentioned stops working. Should I delet it from priv-app/ ? O try to freeze it with titanium?
[Redmi Note 2 Android Development] DarthJabba9:
I deleted everything in /data/media/ other than the 3 specified directories - but Windows explorer is still seeing double with regard to some directories. I think I will just wipe the whole internal sdcard and copy everything over again.

---------- Post added at 03:31 PM ---------- Previous post was at 03:03 PM ----------

Edit: I wiped the internal storage from recovery - but double vision continues in Windows explorer!
[Redmi Note 2 Android Development] jajk:
[MENTION=5669707]Dnxss[/MENTION] Uninstall Find My Device - some apps don't stay frozen. Also uninstall KLO Bug report, Power Keeper (battery saver) and then Whetstone. These are all linked together and to "mcd" service to provide the mother of all spyware. The battery will still warn you when it is low and will last longer without the battery saver waking up the phone all the time:)

Delete the /etc/whetstone folder and whetstone libs in /system lib and system/lib64 to finish the job.

[MENTION=5850987]DarthJabba9[/MENTION] Are you / were you seeing a storage folder along with the usual contents? Make sure to check all the symlinked locations are cleared as well as one of these may be an orphan now and not linked to data/media/0. That is check /sdcard, /storage/sdcard0, storage/emulated/legacy, storage/emulated/0, /mnt/shell/emulated/0, /mnt/shell/emulated/legacy.......I think that's all:silly:
[Redmi Note 2 Android Development] DarthJabba9:
I had a drastic solution - wiped both internal and external sdcards and then restored the backups. All double vision disappeared after that!
[Redmi Note 2 Android Development] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] Nothing drastic about doing that - we are all meticulous in having current off device backups aren't we:eek:
[Redmi Note 2 Android Development] IshtaNoob:
I'm sticking to sMIUI's stock kernel for now, with this script:

According to Kernel Adiutor, most of the time the cpu sits at 1183mhz. How can i lower it to 403?

Edit: your skinnied boot.img "miui8 6721 16" is working. Meanwhile, i changed the go hispeed load to 90 and the timer rate to 38k.
[Redmi Note 2 Android Development] jajk:
[MENTION=6068190]IshtaNoob[/MENTION] Don't use Kernel Aduitor to check cpu state - it generates too much background activity itself so the results are not correct. Use CPU-Z - it is a lot quieter and only bumps the frequencies every 10 seconds. You should be able to drop timer_rate down again but leave go_hispeed_load at 90.

Also try the new way of limiting cores - add this to your script and disable the existing lines reducing cores:

echo "0-3" > /dev/cpuset/foreground/cpus

6.7.21 version has a different kernel to 6.7.28 so may not be perfectly compatible. I will do a 6.7.29 (or 6.8.4 version if someone uploads the boot.img for me) if you are getting good results with the 6.7.21 version? I really don't know what some people are complaining about with the MIUI8 version so I kinda loose interest in catering for them. I am not going to load MIUI8 until a stable global release comes out so I rely on good feedback to iron out any problems..

Everyone: Remember that MIUI8 is only a beta testing version for our phone and contains a heap of (new) bugs at every release.
[Redmi Note 2 Android Development] DarthJabba9:
[MENTION=5952980]jajk[/MENTION] What do you think of the explanations and examples here: https://layer8problem.wordpress.com/2012/10/01/interactive-governor-settings/
[Redmi Note 2 Android Development] DarthJabba9:
The default for "/sys/devices/system/cpu/cpufreq/interactive/timer_slack" is 80000. Any specific reason why we are reducing it?
[Redmi Note 2 Android Development] IshtaNoob:
Your 6721 boot works fine, i notice nothing different (which is neither good nor bad).

That one line was indeed enough to limit cores to 4. Sadly, the cpu still sits mostly on 1183mhz... I'll fiddle a bit more.

i was looking at that, and i realized the examples given show the values within quotes (echo "1000000"). Should i be using quotes as well?
[Redmi Note 2 Android Development] DarthJabba9:
It is not necessary if there are no spaces in what you want to write - but it does not do any harm to use quotes all the time.
[Redmi Note 2 Android Development] IshtaNoob:
I have spaces on the target loads setting, so I'll experiment with quotes (if i can figure out exactly where to put them, lol)

Also, i was reading this https://vjnaik.wordpress.com/2015/06/25/kernel-tweak-interactive-governor-paramaters-rooted-phone/ and i noticed the author references cpu0 and cpu4, to set values for the cores. By omitting that, will the settings be applied to all available cores?

Edit: cpu0 path is invalid, no interactive folder there, so problem solved xD

Edit2: there is, however, a scaling Max frequently setting in there, which is still at 2158.
[Redmi Note 2 Android Development] DarthJabba9:
The quotes should encapsulate everything that you want to echo - just like in the example you gave.
[Redmi Note 2 Android Development] IshtaNoob:
Thanks for explaining. Even without the quotes it seems to be echoing correctly, though.

And now, for something completely different: could the file /proc/cpufreq/cpufreq_volt be responsible for?
[Redmi Note 2 Android Development] DarthJabba9:
For what?
[Redmi Note 2 Android Development] IshtaNoob:
Sorry, the keyboard ate the word "what". I meant what might it be responsible for. Better yet, what could be done with it. Undervolting?
[Redmi Note 2 Android Development] DarthJabba9:
I don't know the answer to those questions - and I am not brave enough to find out by experimentation!
[Redmi Note 2 Android Development] jajk:
[MENTION=6068190]IshtaNoob[/MENTION] The cpu volts are dynamically set so the volts/freq table will change from time to time after a self-test (stress) routine is performed. You may see multiple cores crank up to certain frequencies for no apparent reason shortly after boot - this is the stress test happening before your very eyes. It is all out of our control and a good feature as it amounts to dynamic undervolting. Good that you are looking but don't try to write to those files;)

You are missing some lines if you want to limit max freq - Example:

echo 1781000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 1781000 > /proc/cpufreq/cpufreq_limited_max_freq_by_user

Settings applied to cpu0 are applied to all 8 cores. (we don't have big/little architecture)

[MENTION=5850987]DarthJabba9[/MENTION] The default values are inherited from Linux and fashioned for (older) desktop processors and associated cache/ram technology. It is fairly pointless to increase the value beyond timer_rate + above_hispeed_delay + min_sample_time which is the max delay before the governor responds or is ready to recalculate. The examples quoted are a fair representation of the difference between setting up for battery or performance but the values themselves not particularly good for our SoC.

I like to get the governor to ramp up and down as quick as possible to conserve battery. Too fast and you will see a double-bounce effect in the frequencies or an erratic idle.
[Redmi Note 2 Android Development] IshtaNoob:
Right, just saw it on the "roll your own" thread... information is a bit scattered.

I installed GovTuner to see how it works, and the average cpufreq finally dropped to 806k, now i have to understand why xD
[Redmi Note 2 Android Development] DarthJabba9:
Indeed. The issue here is that, unless one is using init.d to set sensible values, the default values seem totally inappropriate!

How about this for above_hispeed_delay:
[Redmi Note 2 Android Development] IshtaNoob:
Why not include the 403mhz frequency there? (again, sorry for the noobishness)
[Redmi Note 2 Android Development] DarthJabba9:
Because 403mhz is not "high" speed.
[Redmi Note 2 Android Development] IshtaNoob:
Obvious enough, lol, thank you.
[Redmi Note 2 Android Development] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] These are rather long delays. Delaying the upwards increments in freq will make the hotplugging (hps) more likely to switch in another core or 2 defeating your battery conservation.

Hotplugging switches in cores on 95% and out on 85% by default. We can't set the Interactive governor in isolation since there is the perf server and hotplugging functions adding to the mix of available processing power whether by upping frequencies or adding cores.

[MENTION=6068190]IshtaNoob[/MENTION] In Developer Options, enable Show CPU usage and try to see if any process coincides with the cpu jumping in frequency.
[Redmi Note 2 Android Development] jajk:
Skinny_Pro_MIUI7_7510-scary_boot.img posted. This has all the edits in plain view (not stripped) and goes beyond all previous versions in disabling stuff while maintaining full functionality.

Some interesting changes:

I have added another line in init.rc from Android 6 which is also helpful on our phone:

# To prevent out of order acknowledgements from making connection tracking to treat them as not belonging to
# the connection they belong to. Otherwise, a weird issue happens in which some long
# connections on high-throughput links get dropped when an ack packet comes out of order
write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1

In init.modem.rc, disabled the socket rild-vsim stream which is only for the virtual SIM rubbish that I hope you all delete???

I am looking for a definitive and credible article on the optimum settings for TCP buffersize since our phone has some weird values compared to others (not at all surprising). Can you post a link if you know where a good article is?
[Redmi Note 2 Android Development] DarthJabba9:
Yes, indeed. Reducing them to 30000 results in 96% deep sleep (the best so far), but I notice that less time is spent on 806000 and more time on the higher freqs. Idle battery performance seems unaffected. Will do more experiments ...
[Redmi Note 2 Android Development] jajk:
[MENTION=5850987]DarthJabba9[/MENTION] Why do you want to create a controlled staircase up and down? This is dredging up techniques suitable for a Pentium 90.

An interesting exercise but why not let the Governor do the job itself? Every step costs in battery power due to the voltage regulators having to pump the core voltage up and down at every step as well as the lost cpu cycles in managing the step switching. There is a school of thought that argues for being at idle or full speed with no steps in-between. The cores spend less time on and there is minimal stepping losses therefore battery can actually be better. One of the other governors does exactly that. Somewhere in-between works well for me.

Be cautious in relying on figures displayed by cpu spy type apps. Some even confuse the deepsleep time for 806MHz time. There must be some character out of place in the file they interrogate to get the stats. I was looking at it earlier to see if I could easily graph it in a spreadsheet but got distracted.
[Redmi Note 2 Android Development] thepomp:
How to do this sir? Can it run on danielpinto rom?
[Redmi Note 2 Android Development] DarthJabba9:
Experimentation - and if no good results are achieved, then one can always go back to how things were.
[Redmi Note 2 Android Development] jajk:
[MENTION=7331672]thepomp[/MENTION] No, CM is based on Android 5.1. MIUI is based on Android 5.02 so totally incompatible. The CM boot images can certainly be improved since remarkably, they still contain a lot of the original Xiaomi junk settings but I have given up on doing boot images for CM since there are a lot of flaws in these ROMs that users will always attribute to anything else but the ROM itself. If you are able to unpack and repack boot images, you can download one of mine and compare it to the CM one and cherry-pick the edits. Do not ask me for help.

P.S Antutu scores are not indicative of a well setup phone or a reliable benchmark for comparisons. Use Geekbench for a more accurate benchmark - it is often avoided because it brings people back to reality;)

[MENTION=5850987]DarthJabba9[/MENTION] Experimentation is good and participation even better;)
[Redmi Note 2 Android Development] jajk:
Skinny_Pro_MIUI7_7510-684_boot.img posted. This has the kernel and other ancillary files out of the latest 6.8.4 but is otherwise the same as scary version previously posted. The kernel has been altered again so maybe for the better???

Skinny_Pro_MIUI8_684_boot.img posted. For the MIUI8 fans. Suitable for all MIUI8 versions so far. This is full on skinnied except for leaving fdpp service running in init.miui.rc in case this affects MIUI8. I have no idea what it is for and disable it in MIUI7. Can anyone enlighten me?
[Redmi Note 2 Android Development] jajk:
I will answer my own question: fdpp is find device privileged procedure. I would recommend disabling this service and will do so in later MIUI8 revisions.
[Redmi Note 2 Android Development] thepomp:
Can I use 6.8.4 boot img on smiui v8 6.6.30?
[Redmi Note 2 Android Development] DarthJabba9:
Indeed. In any case, benchmarks are meaningless unless there is a specific reason (eg, heavy gaming with games that are very demanding) why you want tremendous CPU performance. All modern SoCs are perfectly fine for normal phone functions, web browsing, music, etc - even those with dual core cpus running at 1.2ghz. The rest is just marketing, "feel good factor", and "mine is better than yours" stuff. Even my ancient Samsung Galaxy SII is running perfectly speedily on Marshmallow (I don't care much for the 800x480 display however).

:D
[Redmi Note 2 Android Development] jajk:
[MENTION=7331672]thepomp[/MENTION] "Suitable for all MIUI8 versions so far" means what it says:p

As with PCs with multicore CPUs, the bottleneck to performance becomes the shared access to cache and RAM. Anything over 4 cores tends to be a marketing stunt. In saying that, the idea of multiple inexpensive cores rather than fewer, more elaborate cores has merit and gives us some pretty scorching performance considering the very basic A53 cores we have. IBM touted this type of configuration back in the late 90's when there was a never-ending (marketing) race for more cpu MHz - nobody listened back then so I guess there are a few old-timers laughing now:)
[Redmi Note 2 Android Development] IshtaNoob:
The 684 skinned boot is working nicely, as would be expected :D

Running it without any governor tweaking reveals a 70%+ usage of 1183 MHz. My quest now is to drop that to 803 MHz stable.

For informative purposes, I've been reading this: http://androidmodguide.blogspot.pt/p/blog-page.html?m=1 (quite thorough guide).

And there's a post about an "ultimate power saving mode" here: http://en.miui.com/thread-322811-1-1.html - doesn't seem to do much, and it didn't close some of the apps i usually keep running, like gsam and gravity screen, so it might be just a work in progress.
[Redmi Note 2 Android Development] IshtaNoob:
How do you measure deep sleep, exactly? Which app to use?
[Redmi Note 2 Android Development] thepomp:
Can someone tell me how to prevent device from awake if wifi on while screen is off. On gsam battery monitor my device awake due to EINT Wake lock and WLAN timeout. Never face this issue on cm. Running on angel&demons v7 now.based on MIUI 7.1.3
[Redmi Note 2 Android Development] DarthJabba9:
BetterBatteryStats
[Redmi Note 2 Android Development] jajk:
[MENTION=6068190]IshtaNoob[/MENTION] Thanks for the confirmation that 684 image is working.

Step 1 is to edit /etc/perfservscntbl.txt which sets the touchboost parameters. I find it totally unnecessary so set it to 403MHz 1 cpu core. There is another touchboost-like mechanism at play that sets the cpu to 1183MHz and 2 cores whenever you touch an active element on the screen or fling it even 1 pixel. This boost is more than adequate to overcome initial sluggish behaviour.

Step 2 is to clear out all the unwanted crap that is running. Yep, this is a hard one for people to let go of their favorite, but crap apps........

Step 3 is to tune the Interactive Governor

after

Step 1 and 2 is done.

Start with exactly this:

#!/system/bin/sh

# Tweak CPU Governor
echo 806000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 95 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 95 > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 35000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack

This will sedate the governor enough to stop the idle freq wandering (apart from excursions due to necessary background activities)

Now drop timer_rate down in steps of 100 until the idle freq starts to wander and then bring it back up 100 to stabilize.

Again, it is pointless to set the hispeed_freq to anything faster since you will already be boosted to 1183MHz and 2 cores anytime you go to do something.

Now the tricky bit, how do you measure what is going on? Don't use Kernel Aduitor! It skews the results and confuses Deep Sleep with 803MHz. There are plenty of CPU Spy / CPU-Z type apps out there, try a few until you find one that you like but beware of the activity they create in their own right that skews results;)

[MENTION=7331672]thepomp[/MENTION] There is loads written about EINT Wake lock and WLAN timeout. Google is your friend. However...... you want wifi to remain working but do not want it to periodically wake up the phone? A service that uses no cpu cycles has not been invented yet.
[Redmi Note 2 Android Development] IshtaNoob:
3h20m SoT so far, with the following settings:

echo 20000 403000:30000 806000:50000 1482000:60000 1885000:60000 > /sys/devices/system/cpu/ cpufreq/interactive/above_hispeed_delay
echo 8000 > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
echo 0 > /sys/devices/system/cpu/cpufreq/interactive/boost
echo 0 > /sys/devices/system/cpu/cpufreq/interactive/boostpulse
echo 95 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 806000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 10000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 95 403000:85 806000:95 1482000:99 1885000:99 > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 38000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo -1 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack

Without the "touch boost" changes, because i had to reflash the rom and completely forgot about it.

I'll wait two more cycles to get more stable results, and then use the settings you propose, to see the difference.

The SoT i got was with normal usage, games, browsing and tweaking xD (1.5h playing clash royale, at least)
[Redmi Note 2 Android Development] jajk:
[MENTION=6068190]IshtaNoob[/MENTION] The following lines are unneeded as boost is disabled in our MTK version of Interactive gov.

echo 8000 > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
echo 0 > /sys/devices/system/cpu/cpufreq/interactive/boost
echo 0 > /sys/devices/system/cpu/cpufreq/interactive/boostpulse

38000 is a bit high for timer_rate and may lead to a slightly sluggish performance. If idle won't settle at values below this, look to find the culprit apps or services that are causing background activity.
[Redmi Note 2 Android Development] thepomp:
I think 7.1.4 final skinny pro boot.img solved my problems. No screen off draining while wifi on. Thanks
[Redmi Note 2 Android Development] IshtaNoob:
When I checked one of those files, I can't remember if it was boost or boospulse, its value was "Failed", so I thought I'd set it at 0 just to make sure.

No sluggish performance here, but I don't play high demanding games.

The CPU still insists on going to 1183mhz for no particular reason, though. 61% at 806, 34% at 1183 (according to System Infor for Android; Kernel Adiutor says 10% at 1183, 18% at 806, with 69% deep sleep).

Finding apps and services that might be influencing this is a terribly hard task, because I want to keep part of the MIUI infrastructure, not completely remove it. I suppose I might as well get used to it :/

How do I check idling values? (time and frequencies spent on idle)
[Redmi Note 2 Android Development] jajk:
[MENTION=6068190]IshtaNoob[/MENTION] Do you use SD Maid to see what is running and what is marked as running at boot? Publish a list of what is running after a clean boot and what is marked as starting at boot and you will get help from those who have gone down this path many a times.
[Redmi Note 2 Android Development] IshtaNoob:
com.android.server.telecom - running

com.securespaces.android.ssm.service - running

com.android.phone - running, start

com.securespaces.android.trustagent - running

com.android.settings - running, start

com.android.systemui - running, start

com.android.mms - start

com.miui.home - running

com.android.managedprovisioning - start

com.android.incallui - running

com.android.providers.media - start

com.android.defcontainer - running

com.android.providers.downloads - start

com.android.providers.contacts - start

com.android.calendar - start

com.android.providers.calendar - start

com.lbe.security.miui - running, start

com.mediatek.batterywarning - start

com.miui.core - running

en.chainfire.supersu - start

com.miui.sysbase - start

com.miui.powerkeeper - start (I left this because I believe it's related to MIUI powersaving features, like the so called "Ultimate Mode")

com.miui.stepsprovider - start

com.miui.securitycore - running, start

com.miui.securityadd - start

com.mediatek.omacp - start (what's this, anyway...?)

com.xiaomi.metok - running (also don't know what this is...)

com.mediatek.thermalmanager - start

com.miui.guardprovider - running

com.fw.upgrade.sysoper - start

com.google.android.syncadapter.contacts - start

com.android.deskclock - start

com.mediatek.acti.service - running, start (another one I don't know)

com.google.android.gms - running

And then some apps:

GSam Battery Monitor Root Companion - running

GSam Battery Monitor - running, start

andoid (system) - start

Hacker's Keyboard - running

Amplify - start

SD Maid - running (obviously)

Gravity Screen - running, start

I already froze some, and removed a lot of autostarts. Thank you for any help.