[GUIDE) A Word about trim - General Topics

Ever since Android announced trim support this topic seems to be ignored ever since.
It shouldnt have been.
At least on some devices manual fstrim (busybox) of any version dont work, at least not fully properly as it should.
Never did, and i highly doubt it does work with android kernel built in command thats supposed todo that on its own.
That would explain the usual performance gain after formating data poartition at least for a few days.
I testet this over the years on S2, Note3, NExus 5, nexus 9 and a few other phones.
latest tests are note 3 and nexus 9 on lineage 14.1 (droid 7.2) and oreo.
Here is the results
On Android (native app, or shell via busybox):
it says it trims, consecutive trims lead smaller sizes and at some point to "trim not required" - as it should be.
However a fter a few minutes data trims again hundreeds of megs, an hour later gigabytes
- wtf - monitoring the write activity showed nothing at all. also the battery should be drained if it writes 20gigs an hour to the sdcard constantly - something seems off.
This behaviour has been as is ever since. fstrim never seem todo much.
Now we test this under twrp on the shell.
after one trim it was imidiatly to zero (so second trim says not required)
allright fine, this is how its supposed to be...
well .... nope ... after remounting it imiditaly wants to trim 100% of the free space.
ext4 is not supposed to work like this on trim, it should always only allow untrimmed freespace (in contrast to btrfs which always trims all).
Now important to know is that fstrim is no relyable method to find out if trim is working or what your block devices does.
it could be very well trim is working as intended but reports wrongly.
However the behaviour of trimming down to little, then to zero, then growing big and fast seems to indicate otherwise.
it looks more l ike trim job marks as trimmed (while its sheduled todo that really) - and unamrk step by step later
if this is true it also means the discard mount option actually is contraproductive at best.
Resolution:
i found that switching to f2fs solves that issue.
Trims are now realistic (like 300mb after 5 hours) zero for a long time, correct sizes when you delete a bigger file and so on.
also its now incredible fast.
the massive difference on my devices between f2fs and ext4 is another indicator that trim never worked. it seems like on the first day.
f2fs is supposed to be 20% slower on reads yet i have across all devices a massive improvment, no mroe lags or stutter on ceertain operations. specially chromiun based browser became lightning fast, as in only fractions of a second loading time, compared to seconds before (which make sense considering how the cache is working all the littel files take up an insane time if you need to clear those bytes first)
oh and did i mention it works very well with encryption on?
well it does, and thers no real speed difference now beween unecrypted and encrypted.
bottom line, i doubt trim ever worked on ext4 systems, at least not on all of them.
f2fs is teh solution at least for such older devices like mine, together with oreo my old ones are back in business... watining for a samsung note with on screen fingerprint reader and no knox )

Related

TweakStock 1.4 & kswapd0 lag - potential solution

I installed @dwitherell's TweakStock 1.4 on my Charge about 5 weeks ago, and I've mostly been happy with it. The one problem I kept running into was deteriorating performance over time, leading to frequent hard lockups requiring hard reboots. I'd gotten to the point where I needed to reboot the phone nearly every day. Having multiple active apps also tended to cause problems, for example Cardiotrainer + Rhapsody music.
Sometimes when the lag hit I was able to get a CPU usage report before the phone fully locked up. At such times I'd see kswapd0 eating a large portion of CPU. That suggested memory problems. I tried tweaking my OOM kill thresholds, to no avail.
This morning, based on some research, I took a look through my build.prop and noticed that this ROM's default VM heap size is a whopping 72MB. That sounded very high, compared to my previous phones where it was 24-32MB. I installed the VM Heap tool, knocked the heap size down to 48MB, and rebooted. My phone has been running as smooth as silk since, even with multiple simultaneously active apps running.
I'll keep watching to see how this holds up over time, but the difference even over a few hours is noticeable enough that I thought I'd report my findings right away. Regrettably, XDA discriminates against new members, so I can't post into the TweakStock developer thread as I would prefer. HTH!
thanks for the tip... just installed Eclipse, at its VM is 48MB.
tweakstock was running great for me though, so real problems like you said. my only problem (minor) was my Scrabble app being such a battery and data hog...
Thanks for the tip -- I had noticed this too, will give it a try. Though I'm on a different version of TweakStock I noticed the heap size is 72 here as well. Trying 48 for a while... will chime in if there's improvement.
- A
It is likely set high because it was found that increasing the VM heap size helped curb hot boots on heavily modified ROMs.
Interesting, thanks for the history @imnuts! I did encounter the hot boot issues some months back on earlier iterations of Gingerbread ROMs for the Charge. I will keep an eye out for hot boots to see if my 48Mb VM heap size is too low, or swap lag if it is still too high. Perhaps we will all have to try to find the best heap size for our usage patterns, as there may be no best one-size-fits-all setting.
Can't remember where, but I think I once read something that said 40 MB is the absolute best size to go with for a variety of reasons. For what that's worth...
Back on tweak stock.... can I just edit the build.prop or do I have to download VM heap?
Thanks!
tappin' that....
jco23 said:
Back on tweak stock.... can I just edit the build.prop or do I have to download VM heap?
Thanks!
tappin' that....
Click to expand...
Click to collapse
Just set the value in the build.prop.
jco23 said:
Back on tweak stock.... can I just edit the build.prop or do I have to download VM heap?
Thanks!
tappin' that....
Click to expand...
Click to collapse
Only change back only when you have issue. I currently using 72m since day one and it's working fine, super fast launching apps.
Fwiw stock settings are 64
Was so thrilled to see this recommendation, as I observed that my phone is really struggling to memory, and then kswapd0 kicks in. Tried to change it to 48MB, then to 64MB. Did not see any improvements. It looks like all apps get pre-loaded into memory, and once free memory hits less than ~80MB, the phone becomes sluggish. Once I kill all apps, the phone is back to normal snappy lag-free operation. Free memory at that point is around 135MB. This is even worse when I insert the phone into car dock. Re-draw takes about 5-7 seconds, swiping is about 2-3 seconds. In few moments it becomes ok, but still laggy.
No problems here
Been on TS1.4 w/ PBJ for about a month now, everything is still as snappy as day one. Thought I was having issues at one point but it turned out it was actually an app, Stitcher Radio, that was eating CPU and draining battery (even though I never launched it). I've over/under clocked with SetCPU at various times but never messed with the voltages.
Nonetheless, thanks to OP for this little tidbit, I'll remember it if I ever start experiencing problems.
ddavv said:
Was so thrilled to see this recommendation, as I observed that my phone is really struggling to memory, and then kswapd0 kicks in. Tried to change it to 48MB, then to 64MB. Did not see any improvements. It looks like all apps get pre-loaded into memory, and once free memory hits less than ~80MB, the phone becomes sluggish. Once I kill all apps, the phone is back to normal snappy lag-free operation. Free memory at that point is around 135MB. This is even worse when I insert the phone into car dock. Re-draw takes about 5-7 seconds, swiping is about 2-3 seconds. In few moments it becomes ok, but still laggy.
Click to expand...
Click to collapse
ddavv, sorry it didn't work for you. Some of the other things I've done to my Charge to help with the lag:
Changed io scheduler to bfq (from sio)
Tweaked my memory manager kill thresholds to 6,8,20,28,32,40 (WIP, YMMV!)
Removed some apps that kept heavy services in memory all the time, e.g. Accuweather & Lookout Security, and streaming media services I didn't use much (Last.fm, Slacker)
Turned off Google location services to stop the k3g_wq CPU runaway bug (this may be fixed in Google Maps > 6.4.0)
Switched to ADW.Launcher
Trimmed widgets I wasn't using frequently (down from 20 to 15)
I still do get a bit of lag after the phone has run for a while, so daily reboots are still a good idea for me - but I'm slowly improving my situation. I'm probably going to take a few hours to do a full wipe & reload once the FP1 ROMs start dropping, and be much more careful about indiscriminate app restoring from Titanium Backup this time. Good luck!

[Q] Want to undervolt CM10. KT747 kernel not working?

I wanted to undervolt my CPU a bit to hopefully get a better battery life. Especially now that I've gotten a tablet (Nexus 7, so nothing to sneeze at) I'm using my phone as a Android device a little less and most of my gaming on it allows for some very low CPU speeds anyway. So to that end, if I can squeeze a little more out of it, it seems like a good idea. I've already taken a LOT of other steps, including minimizing the number of things running all the time (it's actually a little annoying how often things stay running in the background that I just don't need, so Android Assistant is now one of my favorite tools, though I wish its "quick boost" widget and the automatic selections in the process list could stop more apps) and I've even removed a lot of the built in things that run all the time that I don't want like live wallpapers (I really don't understand why it likes to run even if you're not actually using a live wallpaper) and DSP Manager (I want the sound to be unmodifed anyway) among many others. I use SetCPU to set the CPU lower under normal operation with the conservative governor and to even set it extremely low when the screen is off with the powersave governor. WiFi and mobile data stay off when I'm at work and often even at home. Overall battery life is generally quite good, but sometimes it's still going down faster than it really should even just idle with the screen off. If I could just squeeze a little bit more out of it I'd be a lot happier. Plus it also can get fairly hot despite the underclocking on those occasions I do play a game thanks in no small part to the fact that I'm having to use an Otterbox on it (which means not one, not two, but THREE layers of insulation on the back side when Samsung pretty much designed it with one in mind. More heat escapes through the glass at the front than the rear and that's saying something given that glass is a pretty strong insulator... Otterbox truly needs to design these with some sort of thermally conductive material or something.) I don't know that undervolting would help a lot with either since I probably can't go down by much, but it most certainly can't hurt...
Ok, so I grabbed the KT747 kernel for the Verizon SGS3 from here (I got the AOSP Jellybean version, not Touchwiz) and tried to install it using the update function in ClockworkMod then cleared the cache partition and Dalvik cache both immediately after. The moment I hit reboot, the phone got stuck on a black screen or shut off (I couldn't exactly tell which.) I didn't find a convenient CM10 kernel alone, so had to basically just put the full CM10 update which of course was a bit inconvenient since I had to redo a lot of stuff. Is that the incorrect way to install it? So far everywhere I've looked everyone just skips over the part about the actual install process -- they just say to install it. Given that it's distributed as a ZIP complete with the normal stuff one would see in a recovery update ZIP I assumed that was the appropriate way (and it did say it was successful and all.) Well, I've read in that thread and others that sometimes it just doesn't work with some phones, so my assumption is that was the case here, but just in case if I've installed it wrong it would help to try doing it right, lol.
Is there any other kernel I should try with CM10? I don't need any special features (definitely no Voodoo sound or whatever -- again, I like the sound being unmodified anyway) beyond the normal stuff other than the ability to undervolt the CPU by a bit. I'd like to do the undervolting with SetCPU if I could as it overall suits me best of the tools I've tried and even has a "safe mode" ZIP file that can be installed as if it were an update in the recovery menu that would stop it from doing its thing if something goes wrong, thus making it safe even to use the set on boot option (though I suspect that with my current underclocking the CPU will remain stable until I push it at any reasonable undervolt level.) Or am I maybe even missing something and CM10 actually has the ability built in that I just haven't found anywhere? I see options to set the CPU min/max, governor and I/O, but nothing about things like voltage (or overclocking for that matter, where I assume such settings would probably lie.) From my understanding, the fact that SetCPU lacks even a tab for voltage control on here means that it thinks the kernel doesn't support it though.
EDIT: Oops, forgot to mention, but I did do "fix permissions" after clearing both types of cache. Also, the system is definitely on when it just goes black. When I press the power button I get the power LED on green indicating that the battery is nearly full and the hardware button backlights come on.
You're correct on assuming that since SetCPU doesn't have the tab the kernel doesn't support it. Try leankernel. It's what I always run. I don't have the URL handy but it's on rootzwiki. It has a TW and AOSP version so obviously make sure you grab the right one.
Ok, something's odd here. I tried the LeanKernel for Verizon (lk_aosp_jb_vzw-v1.9.zip from http://rootzwiki.com/topic/32286-kernel-aosp-jb-leankernel-minimalistic-kernel-v19-111012/ -- or, more accurately, from what I believe is his official page at http://imoseyon.host4droid.com/s3/#!/view=details/lang=en/sort=na) and again the same thing. Just a black screen. I can get the lights to come on behind the bottom hardware buttons, but it's not working right. It seems it DOES boot up enough to where I can connect with adb thank goodness (I had to pull the battery twice before I thought to see what would happen) and get a shell, so I tried running lkconfig and setting it to not undervolt by default (I don't really understand why so many kernels under/overvolt/clock by default when you can so easily mess with those things via software after it's actually up and running) but even after another reboot or two it still didn't work. Again, I cleared BOTH caches and ran fix permissions after installing the kernel from the zip file. Also, I'm trying TWRP now instead of ClockworkMod as it seems to be quite a lot better (touch interface in the free version, ability to choose WHAT to backup so I don't have to backup data every time -- which is really handy since I lack the free space to backup data and always have to wait for CWM to error out -- and a bunch of other nice little things) and I'm getting the same problem with it.
I even tried waiting a while in case it was doing the "Android is upgrading" thing where I guess it's basically just rebuilding the Dalvik cache, but the screen still wouldn't come on at any point after that even after another reboot. It's worth noting that the adb shell it gave me went straight to root (eg a # sign on the prompt) whereas under a normal bootup it should be at user level first requiring me to run su to get root. Am I just missing something or what?

ZOMBi-POP OMNI KANG RC1 - Slowness when using the tablet after sleep/some time.

Hi All,
I know Zombi-POP is still in RC1 so I'm sure there are still quite a few issues. The issue I seem to be having is the tablet is VERY slow once you use it from sleep/sitting for a while. I'm not sure what its doing once I start using it again but it takes about 3-5 minutes to get back to hauling butt. I notice when playing a game that there is performance hit every 2 seconds. I can see the animation lagging so its very noticable and constant. Does anyone know what could be going on?
TF700T:
* ROM2SD on 64GB Sandisk 10. I partitioned it 16/43/1 EXT4. I'm staying away from F2FS since data could corrupt.
* Recommended settings put in place based on install notes on forum.
Governor:Interactive (not like I can change it anyways)
IO scheduler:noop
Thanks for the help. I would post this in the correct area but I'm not allowed to post there yet due to my newbie status .
That sounds as if you have automatic updates in the Play Store active. Turn it off.
And get rid of the FB app if you use it (acess it in browser instead). Any app that feels the need to phone home as soon as the tablet wakes up will make this lag-on-wake worse: weather apps, forum apps, mail... what have you.
For your game you could try to play with the Transition animation and Animator duration scale in Developer Options. Set them to .5 and see if that helps.
You should really give f2fs on internal a whirl. As long as we have been playing with f2fs I still have to hear from a single user who had data loss issues because of it. And anyway - if you keep sensitive data on your portable device you should have a solid backup routine in place no matter what. And if you do data loss is a non-issue
mediaserver is the issue...
I was watching the system for a while during wakeups and found that the mediaserver process is causing this slowdown. I guess its scanning the driver? I'm not sure. All I know is there is a app already created out there that kills the mediaserver process for good. I tried killing it from the terminal but it starts up right afterwards. I'll stick with EXT4 for now. The performance is great for me once that process is gone and I'm more familiar with EXT4.
Thanks!
Andy
berndblb said:
That sounds as if you have automatic updates in the Play Store active. Turn it off.
And get rid of the FB app if you use it (acess it in browser instead). Any app that feels the need to phone home as soon as the tablet wakes up will make this lag-on-wake worse: weather apps, forum apps, mail... what have you.
For your game you could try to play with the Transition animation and Animator duration scale in Developer Options. Set them to .5 and see if that helps.
You should really give f2fs on internal a whirl. As long as we have been playing with f2fs I still have to hear from a single user who had data loss issues because of it. And anyway - if you keep sensitive data on your portable device you should have a solid backup routine in place no matter what. And if you do data loss is a non-issue
Click to expand...
Click to collapse
You should really switch to internal and F2FS - there is no risk of corruption. Rom2sd doesn't play well with zombi.

Android 6 & 1+

I've been using Android 6 for a little over a week now and while I'm happy to see it's progress, I'm disappointed with some of finer details that seems to be missing from it giving an overall impression of ”betaness”.
For instance, running audible while playing in Android 5, I could play it indefinitely when the power was off. It seems it's "keep awake" function worked… It doesn't in Android 6. At least not in the two Android 6 roms I've tried. A min or so after my phone shuts off, Audible just stops running.
I've noticed that it's a challenge working with external storage. The whole experience in trying to get them to work with 6 has been an exercise of patience and persistence. I transfer files a lot with my phone ... It's become tiring to do it. I haven't had this to type of trouble with that since Cupcake. Things as simple as transferring a file to a usb drive from my phone simply doesn't work on 90% of the file managers out there. This feels like a step backwards.
I don't do anything crazy with my Rom besides slightly under clocking. I set a 1024 Read ahead buffer and use an interactive governor. All very minor changes.
Are most of these changes/problems application related? Meaning have the devs lagged behind the coming of Android 6?
UltraBoykj said:
I've been using Android 6 for a little over a week now and while I'm happy to see it's progress, I'm disappointed with some of finer details that seems to be missing from it giving an overall impression of ”betaness”.
For instance, running audible while playing in Android 5, I could play it indefinitely when the power was off. It seems it's "keep awake" function worked… It doesn't in Android 6. At least not in the two Android 6 roms I've tried. A min or so after my phone shuts off, Audible just stops running.
I've noticed that it's a challenge working with external storage. The whole experience in trying to get them to work with 6 has been an exercise of patience and persistence. I transfer files a lot with my phone ... It's become tiring to do it. I haven't had this to type of trouble with that since Cupcake. Things as simple as transferring a file to a usb drive from my phone simply doesn't work on 90% of the file managers out there. This feels like a step backwards.
I don't do anything crazy with my Rom besides slightly under clocking. I set a 1024 Read ahead buffer and use an interactive governor. All very minor changes.
Are most of these changes/problems application related? Meaning have the devs lagged behind the coming of Android 6?
Click to expand...
Click to collapse
It's gonna take some time before we have anything that can be labelled as stable for Marshmallow. All ROMs out are still in Beta stages so if you want stability then you'll have to go back to Lollipop. Simple [emoji4]
Sent from my A0001 using Tapatalk
Seems I needed to learn what Battery settings exist for Android 6. Like Doze. Well that corrects a couple of issues.

The possible best and functional alternative to Kernel Adiutor

the title says it all, but not to leave them with later doubts, I tell you: I have installed Cyanogenmod with Android 5.1, which of course I'm going for luxury. The detail is that I currently use Kernel Adiutor for CPU / GPU settings and the extras it has. the detail is that I do adjustment after adjustment and then ... it comes to work, unfortunately I have problems with other applications and I must be making adjustments every so often. I have some settings (at the moment) so I can use it for PUBG (which gives in some cases flaws in sound and after some time the application fails completely forcing the phone lock (S3 Neo)). I must resort to the application to give a half solution that finally does that, solve the problem halfway .. Because of the "half solution" I've been doubting if the application itself runs the changes above (a placebo effect), this is because the device once in even with the minimum CPU / GPU settings the phone starts to behave slowly (as is normal) but also consumes a large amount of battery, in the afternoon watching streaming (through medium settings in the application) the battery It drops quickly, from 52% to 9% in an average time of 10 minutes, I was finding out if I changed the application for an at least more durable alternative to Kernel Adiutor (like SetCPU or similar) but I doubt that they are compatible with the version of Android that I own or, if it will also apply placebo effect, as I am beginning to notice.
And if in case of mentioning the battery, it is better not to say anything about it since it is not battery failure. It's the same one that I've always owned, plus, unlike this one, it worked better via Stock for obvious reasons.

Categories

Resources