yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] Lanchon:
no it wouldnt work for omni. the purpose of this thread is proving the safety of trim on the platform when done correctly. i think that objective is done. a couple other kernels have incorporated trim now, at least 3: raw, forest, and one more i can't remember. you can use those kernels on other roms.

you can also trim a big unused area such as preload and then switch to a non-trim kernel, and that will provide significant benefits over a non-trimmed emmc
[Galaxy S II Android Development] Acid0057:
Gustavo was the other Kernel that incorporated trim. In his post it actually says that it supports Omni so it could be an option [MENTION=4221342]3l3ctr0[/MENTION] no lollipop support on his kernel yet [MENTION=4474911]RuffBuster[/MENTION]
[Galaxy S II Android Development] 3l3ctr0:
Too bad, but thanks for the answer and for your work.:good:

Maybe I will try to trim preload or use a custom kernel which has trim enabled

Thanks guys
[Galaxy S II Android Development] RuffBuster:
So I could use your cm11 kernel to run trim command let's say from a script in recovery and flash back my Lollipop kernel and the trim will have done it's job? Doesn't trim need a compatible kernel to stay active? And does trim run from when I launch script or when phone is idling? Thank you.
[Galaxy S II Android Development] Lanchon:
please read the OP and/or wikipedia. its all there.
[Galaxy S II Android Development] RuffBuster:
Apologies. The information I needed was indeed in the OP.
[Galaxy S II Android Development] :
Edit: Sorry, I'll post this in the n7000 thread ^^
[Galaxy S II Android Development] ajislav:
Any chance of an updated i9100 kernel? Thank you Lanchon
[Galaxy S II Android Development] Lanchon:
yes chance! im waiting for the M13 release.

anyway, there have been no changes to the kernel for a looooong time, until 6 days ago on Mar 10.

so my kernels are officially up to date till the cm-11-20150309 nightlies (the previous to last as of now).

and they are not guaranteed to work on the cm-11-20150316 nightlies (the latest), and from there on.

i dont want my kernels to be out of date for more than a month. if on Apr 10 we still dont have an M13, remind me and i'll build an updated set.

EDIT: reports say my kernels run fine on 20150316 :)
[Galaxy S II Android Development] ferret141:
Can anyone make sense of these please?

Before

After - Wifi On

After - Wifi Off
[Galaxy S II Android Development] Lanchon:
i can! androbench is not very repeatable as was said before; ignore it.
[Galaxy S II Android Development] ferret141:
Is there anything that is?
[Galaxy S II Android Development] Lanchon:
it's simple. either your emmc was in need of trim or it wasnt. if it wasnt, by trimming you wont get any benefit. if it was, the benefits should be notorious in use, particularly in smoothness.

in time, all emmcs that are written to will need trim. trim was added to SSDs and EMMCs and file systems of all major operating systems (in our case, the linux kernel) because this reality is unavoidable. android from 4.3 on is optimized for trimming in the best possible way.

bottom line is, there is no question that you will needed, it's just a question of when. trim was removed from these devices because the standard implementation used to kill their emmcs due to a bug in their firmware. this kernel implements trim in a safe way for every possible type of emmc on these devices. now there is no reason not to trim. use my kernel or any number of other kernels that have correcly merged the changes (dont ask me which), but do use a trim kernel.

the exception is: if trim commands in your device finish instantly, then your device probably has trim disabled in hardware. there is no benefit to trim kernels then, and once your emmc goes slow, there is no way to ever restore speed (except maybe fully resetting the emmc, which erases bootloaders and so is VERY dangerous). this is explained in the OP.

EDIT: if your device can't trim, make sure to never, NOT EVEN FOR A SECOND, have your internal sdcard more than 75% used. better to keep it at 50% or even less. better still to stop using it and use an external sdcard. otherwise you run the risk of slowing your device forever.
[Galaxy S II Android Development] ferret141:
When I executed TRIM via Terminal emulator it was instant.

Based on what you said I wondered if it would be any different using Lagfix. Gave it 10min SU access. Reports something like "failed to TRIM: permission denied". Cleared app data because the RUN button became disabled. Tried again and it ran fine. System trimmed instantly. Data took a minute. Cache trimmed instantly.

Has it really trimmed it? I'm beginning to thing I'm experiencing placebo improvements. Also system info shows the kernel as:

3.0.64-CM-g4ca83ff-dirty

rod@rod-latitude #1

Sun Dec 21 19:32:19 ART 2014
[Galaxy S II Android Development] Lanchon:
so you are good! instantly is really instantly, like 0.1 seconds. only very few EMMC models have trim disabled, they are quite rare.
[Galaxy S II Android Development] varun94:
mine takes about 1-2 seconds for data.so does my emmc support trim?.whats the average time that data will take to trim?
[Galaxy S II Android Development] Lanchon:
i dont know, i guess 1/2 seconds is ok.
[Galaxy S II Android Development] xman323:
The speed difference in the device now is astonishing

I have a Nexus 5 now but i still have my old S2 and i can say that it's amazing now

thank you sir!
[Galaxy S II Android Development] Lanchon:
UPDATE: new kernel for the latest nightly:

cm-11-20150323-NIGHTLY-i9100

enjoy!
[Galaxy S II Android Development] JulGer01:
Thanks. Working well on n7000.

Gesendet von meinem GT-N7000 mit Tapatalk
[Galaxy S II Android Development] x3dnd3x:
Can I use this latest kernel? I'm still on CM11 20141218.

And also, updating the kernel means I have to do the process all over again like kernel wipe script + lagfix or I can just flash straight over? :confused:
[Galaxy S II Android Development] Lanchon:
dont use this kernel! this one is for the newest nightlies.

no, you just flash the nightly, then the kernel and thats it.
[Galaxy S II Android Development] vdZERO:
Hey Lanchon, do you have the time to make a kernel for the cm-11-20150330-NIGHTLY-i9100? I'm on M11 (waiting for the M13 that is nowhere in sight) and decided to flash a new nightly. This one seems to have a bunch of fixes so I prefer to flash this over the 23 one.

Thank you.
[Galaxy S II Android Development] Lanchon:
there are no kernel changes since my last kernel set:

https://github.com/CyanogenMod/android_kernel_samsung_smdk4412/commits/cm-11.0
[Galaxy S II Android Development] vdZERO:
So that means it is safe to flash the 23 kernel with the 30 nightly? Sorry for bugging you I'm not an advanced user :)
[Galaxy S II Android Development] ajislav:
Yes, you can safely flash it.
[Galaxy S II Android Development] vdZERO:
Thanks!

These are my results before flashing the latest nightly and your TRIM kernel and after. It is a big improvement!

Thank you very much for your time and effort spent on speeding up this awesome phone.
[Galaxy S II Android Development] :
[MENTION=4141005]Lanchon[/MENTION]

I installed CM and want to install your kernel but it seems old 03.27 the cm11 is I have is 04.19 nightly. Was there any kernel updates since then? can I use it for latest nightly?

GT-N7000...
[Galaxy S II Android Development] Lanchon:
you are welcome, thanks for posting ur results
[Galaxy S II Android Development] Lanchon:
my kernels are up to date, please read the previous messages
[Galaxy S II Android Development] :
Thanks. I checked the link you gave it seems new update on 13th April for 4412 can you check it.

https://github.com/CyanogenMod/android_kernel_samsung_smdk4412/commits/cm-11.0

GT-N7000...
[Galaxy S II Android Development] Lanchon:
yes, i already did, and my kernels are up to date. that source level change does not change a single bit of my kernels. nor of CMs for that matter.
[Galaxy S II Android Development] imation_nz:
Hey Guys just needing some help I had to start using my s2 again as s3 broke.

I'm running cm11 nightly and have also re-partitioned my drives. As pictured

But it's just running so slow and lags with maps and stuff. Can anyone help me speed this beast up and advise me if this trim will help or anything else. I have attached some pics about my device.

Thanks for taking your time in helping me
[Galaxy S II Android Development] Lanchon:
hi! just flash the latest kernel and trim the partitions.
[Galaxy S II Android Development] Malhavoc Blackdrake:
One thing I did not get, and could not find searching the forum: does formatting the SD card through recovery, and then flashing my favourite ROM, avoid the need for Trimming, at least in the short run (of course performance would still decrease in time)?

Asking this because at the moment I would prefer to stick with LP roms, which hardly have a working kernel with Trim. Would I gain anything from temporary switching to and older CM, doing Trim, and then going back to Lollipop? Or would I gain the same result just by formatting the SD card from the recovery?
[Galaxy S II Android Development] Lanchon:
formatting does not trim. to trim you can: boot recovery, flash my kernel, reboot recovery, trim, flash back LP kernel, and reboot.

if you have a big (ie: stock) /preload partition (0.5GB), AND YOU ARE USING A CUSTOM ROM SUCH AS CM WHICH DOESNT USE PRELOAD, you can:

-format it or remove all files in it (look for hidden files/folders)

-boot recovery, flash my kernel, reboot recovery, trim everything INCLUDING /PRELOAD, flash back LP kernel, and reboot

the 0.5GB trimmed space in /preload will never be written to and will act as SSD overprovitioning, extending the life of the eMMC and making it go faster, even if you never trim again. (until you start writing to /preload if ever, that is.)
[Galaxy S II Android Development] Malhavoc Blackdrake:
Thank you, I'll test it this weekend if I can, and report results and also pre&post benchmarks.

Just one more question: looking at the links, I am not totally sure of the kernel I should flash: there are some "Generic Android CM" ones, and then some for GS2 under Home/Samsung/Galaxy S2/Lanchon, to be exact there are three files, labeled "thiswillhardbrickblabla" and two also with "BAD-WIFI". Each one has date around August 2014.

Are these the correct ones? The "Android Generic" ones are a bit more recent (december 2014), and they also talk about the FPBug fix.
[Galaxy S II Android Development] JudgeDread11:
What about the brick bug? I read there is a risk in the op, is there still or has tests proven there is no risk?

I'm on galaxy s2 i9100, resurrection remix rom, Android 5.1.1, with a repositioned memory (1 GB system and 4 GB data)

According to the eMMC info app I am affected by the brick bug (insane chip).

I want to try a trim enabled kernel, is it considered safe with the brick bug?
[Galaxy S II Android Development] ssanjy:
I don't think this kernel supports lollipop yet... Head over to thread by [MENTION=5811506]gsstudios[/MENTION] for dorimanx with trim support for 5.1CM based ROMs.....http://xdaforums.com/showthread.php?t=3145879.......However if your emmc is one of the brick bug ones then it's up to you to decided whether or not to use trim... Some users have reported working trim despite brick bug but some has actually bricked their device.... It's your call after all....
[Galaxy S II Android Development] Lanchon:
this is incorrect; nobody bricked any device with my kernels, and no one will.
[Galaxy S II Android Development] Lanchon:
your questions regarding safety are all answered in the OP. and there is more info in the rest of the thread. lol, not to be rude or anything, but you are expected to at least read the OP before you post
[Galaxy S II Android Development] Spyr0s:
is there going to be a trim enabled kernel for cm 12.1 nightlies?
[Galaxy S II Android Development] ssanjy:
Sorry [MENTION=4141005]Lanchon[/MENTION] I didn't meant to say that your kernel bricked devices....I had read on other thread that some unfortunate guys had bricked their devices..... Sorry for not mentioning that.....[emoji106]
[Galaxy S II Android Development] JudgeDread11:
http://xdaforums.com/showthread.php?p=57100312

Post 3
[Galaxy S II Android Development] Saber:
Except that lysergic acid has his kernel builds with trim disabled.
[Galaxy S II Android Development] JudgeDread11:
http://xdaforums.com/showthread.php?p=61597808

There should be a trim enabled version here :)
[Galaxy S II Android Development] ajislav:
I would not mind having a stock CM12.1 TRIM-enabled kernel from [MENTION=4141005]Lanchon[/MENTION], as this should be fairly easy for him to do, but let's wait a few weeks once the nightlies stabilize a bit..

In the mean time, one can always do the trimming in recovery (as described by Lanchon few posts above)
[Galaxy S II Android Development] Lanchon:
thats the plan. but im on vacation so no right now :)
[Galaxy S II Android Development] Spyr0s:
have some nice vacations :good:
[Galaxy S II Android Development] Malhavoc Blackdrake:
Ok, flashed the kernel, run the adb command, received the number of trimmed bytes after some seconds, reflashed previous kernel, reboot.

Here the benchmarks. I've run them three times both before and after the TRIM (the ones after the asterisk are the after TRIM ones). Overall all numbers are more or less the same, with maybe some littel improvements here and there, APART from the random writes, which clearly received an upgrade higher than +100% !!

seq rd (MB/s)

41

45

45

*

44

46

44

seq wr (MB/s)

12

13

10

*

14

13

11

rn rd (IOPS)

1153

1197

1143

*

1145

1177

1134

rnd wr (IOPS)

50

49

29

*

96

97

98

insert (TPS)

19

16

20

*

23

23

22

update (TPS)

22

18

23

*

27

27

28

delete (TPS)

24

18

25

*

28

27

28

browser (msec)

488

530

560

*

434

331

325

market (msec)

1103

818

1043

*

881

1088

1070

camera (msec)

644

740

652

*

980

705

609

camcorder (msec)

1628

1764

1907

*

1895

2188

1884
[Galaxy S II Android Development] kai1313:
I did TRIM my phone with terminal help because when im using lagfixx free 1.5.1 from the thread this thread reffer to , i got error that said not supported

But when i do with terminal with this command

su -c "fstrim -v /system; fstrim -v /data; fstrim -v /cache; fstrim -v /preload"

i got this

did i succeed trimming my phone or not?
[Galaxy S II Android Development] Lanchon:
random writes are among the slowest ops in these devices, and happen all the time in real use, and thus they do make a difference.
[Galaxy S II Android Development] Lanchon:
yes you did. lagfix must be given root to work.
[Galaxy S II Android Development] kai1313:
its a relieve to hear that :D

here my androbench before and after
[Galaxy S II Android Development] Malhavoc Blackdrake:
I can also confirm that the phone is much more fluid now. Since I had the preload partition formatted and trimmed, I hope it will last a bit even with a non-trim kernel.

I also take the chance to suggest everyone to check for the partitions to be mounted before running the script or the adb commands (no need for that if you use Lagfix, but Lagfix can't Trim preload). At the start I didn't, and wasn't sure what was going wrong :D
[Galaxy S II Android Development] Lanchon:
hey, could someone pls test the 12.1 kernels i posted?

they should be flashable from brain-dead stock cm recovery.

in particular, can you verify that the wifi works?

thanks!
[Galaxy S II Android Development] Spyr0s:
It works, flashed from cm recovery over 9/7 nightly:good:
[Galaxy S II Android Development] Lanchon:
UPDATE: new kernels are up!

CM 12.1 kernels are now available!!! (for CM 12.1-supported platforms only: i9100 and i777.)

kernels can now be flashed with the official, restricted cyanogen recovery that is bundled with CM 12.1.

kernels are no longer dependent one-to-one on specific official CM builds (they might work with other roms too), and their names no longer reference a specific CM build.

although there are no official CM 11 builds for the i777, thanks to rom independence CM 11-based kernels for that device are now available.

CM 11 i9100-to-i777 cross-flash kernels for the i777 may now work with other i9100 roms besides official CM.

enjoy!
[Galaxy S II Android Development] Acid0057:
Downloaded, flashed, rebooted, trimmed in terminal, rebooted again and Phone is flying. I'm not complaining but whatever you did on your updates [MENTION=4141005]Lanchon[/MENTION] was awesome. I'm on the last cm11 nightly from June 14th.

After flashing this phone almost daily from cm9, cm10, 10.2.3 and 11 it's weird to be on the same Rom for almost a month.

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] nguyenthuongvu31:
[IMG]http://i.imgur.com/tLKBfeQ.jpg[/IMG]

i use cm12.1 nightly......................but recovery not support install zip..........how to take custom recovery on this rom..........Help

Lagfix not support .............................:crying::crying::crying:
[Galaxy S II Android Development] Saber:
go to apply update and select the zip. It is required that you sign the zip before flashing with Cyanogen recovery using Sign-em or Sign+.

Alternatively, you can flash philz recovery first via ODIN then flash the kernel.
[Galaxy S II Android Development] Lanchon:
my cm12.1 kernels are already whole-file signed with the test keys.
[Galaxy S II Android Development] Lanchon:
yes! you can flash the kernel from official CM recovery! what is the error you see?

instead of lagfix use Trimmer:

https://play.google.com/store/apps/details?id=com.fifthelement.trimmer
[Galaxy S II Android Development] Lanchon:
lol, well im glad it worked, but probably your phone just needed trimming. yes, it should auto trim, but who knows...

get the Trimmer app and schedule a nightly trim :)
[Galaxy S II Android Development] Acid0057:
I'll check it out. Thanks lanchon! Yep you're most likely right about it needing trimming.

EDIT: Is it necessary to reboot after trimming with trimmer? I do every time I do it from the terminal.

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] Lanchon:
not needed for data or device safety.

regarding performance, who knows what firmwarez are inside the emmc! my intuition is that it isn't, and i never reboot after trimming. even if it were needed, if you trim regularly, the last one trim won't make too much of a difference, so no reason to reboot.
[Galaxy S II Android Development] Acid0057:
Sounds good thanks! Now if only trimmer could trim my sdcards too

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] Lanchon:
for those who still don't know...

UPDATE: there is a replacement app for LagFix called Trimmer that has several advantages over the former: is fully free, can schedule TRIMs, and is compatible with Android 5.
[Galaxy S II Android Development] Acid0057:
I've also been in touch with the Trimmer dev about adding support for sdcards as well.

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] Lanchon:
well regardless of hardware support (many sdcards are optimized for streaming and are very different from ssds; also the cpu in them is very underpowered), most cards are formatted in fat, which doesnt trim with our kernels.
[Galaxy S II Android Development] Acid0057:
Yep I know I'm a limited case. I've formatted the internal SD and my external SD to ext4. They both trim via the terminal commands on you're kernel [emoji1]

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] Lanchon:
hmmm... i dont know if that trim has any effect. you would need to measure performance on each card i guess.

anyway, sdcards are designed to be kept mostly constant. trimming them shouldnt add much
[Galaxy S II Android Development] Acid0057:
Very true lanchon. Thanks!

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] kai1313:
can i use the update from official CM if i flash this kernel?

im new with cm official build, as far as i know official build advantage is we can update without going to recovery like other unofficial roms

and is it trim the preload didnt affect much?

because trim apps(lagfixx trimmer) didnt give the trim preload choice

and 1 thing, how to flash using cm recovery, this is so different with the recovery i always use(cwm/twrp)
[Galaxy S II Android Development] Lanchon:
1) yes you can update official cm without flashing another recovery.

2) my crystal ball wasnt clear on your preload thing. but you can trim manually if you want. do it once and forget it for ever. read the OP.

3) select install update and then my kernel, thats all.
[Galaxy S II Android Development] kai1313:
here my test with CM LP latest nightly :good:

i wanna ask something, this cm recovery didnt have backup/restore option on it, is it safe to change the recovery like CWM/TWRP?

will it affect the OTA update when it available?
[Galaxy S II Android Development] haris1976:
this my result. Is ur trim succesed or not ?
[Galaxy S II Android Development] Lanchon:
no, you cant use an alternative recovery. kernel and recovery are monolithic on this device. forget about custom recoveries.
[Galaxy S II Android Development] kostelo:
Yes it is completed successfully.

Sent from my GT-I9100
[Galaxy S II Android Development] kai1313:
after OTA update by CM12.1 nightly are we need to reflash the kernel?
[Galaxy S II Android Development] Lanchon:
of course. OTAs overwrite the kernel.
[Galaxy S II Android Development] cherryb8844:
After flashing kernel and using trimmer app

---------- Post added at 03:00 PM ---------- Previous post was at 02:58 PM ----------

Cm12.1 first nightly
[Galaxy S II Android Development] Lanchon:
androbench is not very repeatable. i meant to delete references in the OP for a while, finally did it just now.

regarding your benchmarks, your device doubled the random write performance which is the important metric. after that you should have felt that the phone was much smoother.
[Galaxy S II Android Development] kai1313:
sorry for asking a basic

if we use this kernel tor trim the phone, then we got/do an OTA update(cm12.1official or other) which is replace the kernel with stock again

will the effect of the trim disappear at once?

do we need to replace the stock kernel with trim kernel to do trimming again or

can we wait till our next trim schedule for replace the kernel?
[Galaxy S II Android Development] cherryb8844:
This is not good with my device?
[Galaxy S II Android Development] Lanchon:
the effects of trim will not disappear at once, but they will disappear with passage of time.

to avoid this, always flash my kernel after an ota.

also recommend you set up Trimmer app so that it trims the phone every night.

that way you dont need to manually trim ever again.
[Galaxy S II Android Development] Lanchon:
yes, it worked.
[Galaxy S II Android Development] Skorvy:
Just flashed yr kernel and trimm. Seems a working little faster(latest cm12.1 nightly). One thing, i need to format my internal mem to ext to have full trimm experience right?
[Galaxy S II Android Development] Acid0057:
Ext4 file system and yes. Although I didn't notice to much in a speed boost after I did. Also trimmer and lag fix don't trim sdcards, including our internal SD. You'll need to do it manually from the terminal. Here's the command I use

su -c "fstrim -v /system; fstrim -v /data; fstrim -v /cache; fstrim -v /preload; fstrim -v /mnt/media_rw/sdcard0; fstrim -v /mnt/media_rw/sdcard1"

Also be careful when changing to ext4. Make sure you're rom supports ext4, lanchons kernel here does.

Sent from my GT-I9100 flowing on SwiftKey in Tapatalk
[Galaxy S II Android Development] Skorvy:
Thx, will do it now from terminal. I think cyanogen nightly and op kernel support ext format right?