75

charging, battery, performance, caches and battery calibration myths busted

  1. anupritaisno1 KitKat Jul 19, 2019

    anupritaisno1, Jul 19, 2019 :
    Actually f2fs does need defragmentation. Ext4 does too

    And yes defragmentation harms storage but it is required because the software itself has limitations

    Fragmentation on filesystems is such a problem on android Google is copying the storage controller data to ram and remapping blocks in ram. This allows "defragmentation" by simply remapping data without actually doing a defragmentation pass on the disk

    Fragmentation on sdcards too is a problem. Samsung devices have a proprietary defrag daemon that periodically defragments your sdcards

    If fragmentation really isn't a problem for either of ext4 or f2fs why do Google and Samsung go to such great lengths to defragment device storage?
     

    Praty_28 likes this.
  2. anupritaisno1 KitKat Jul 19, 2019

    anupritaisno1, Jul 19, 2019 :
    And now @dsmonteiro will arrive here and cite a lack of sources

    A study on filesystem fragmentation in mobile phones:
    https://www.usenix.org/system/files/conference/hotstorage16/hotstorage16_ji.pdf

    Samsung defrag daemon wasn't opensourced for the sdfat driver:
    https://github.com/cryptomilk/kernel-sdfat/issues/12

    Google themselves mention defragmentation while adding f2fs to the pixel 3:
    https://android.googlesource.com/device/google/crosshatch/ /a0d74ba2c0b943c6370288b13ade0cf6c4868da2
     

    Praty_28 and sammerasker like this.
  3. elanglois Lollipop Jul 21, 2019

    elanglois, Jul 21, 2019 :
    Well, you can say it all you want, but I have seen issues where half the apps on the phone were crashing after an update and clearing cache is the fix.

    And if its a Lineage thing, then we aren't talking stock Android. Lots of ROMs are AOSP and I prefer AOSP based ROMs.
     

  4. elanglois Lollipop Jul 21, 2019

    elanglois, Jul 21, 2019 :
    SD Cards would be an issue since they are typically FAT.

    "Modern Linux filesystem(s) keep fragmentation at a minimum by keeping all blocks in a file close together, even if they can't be stored in consecutive sectors. Some filesystems, like ext3, effectively allocate the free block that is nearest to other blocks in a file. Therefore it is not necessary to worry about fragmentation in a Linux system."

    That said, very large files written in slow increments could get fragmented, but we're talking things like the system log. They generally aren't accessed much to worry about and flash file systems don't have a seek time, so I fail to see why it would ever be an issue.

    As I said, a lot of people have been calling f2fs garbage collection a "defrag", when its not the same thing. Kinda like people saying this phone has 8GB of RAM and 256GB of ROM .... manufacturers put crap like that in spec sheets but we all know the phone's storage is not ROM!
     

  5. elanglois Lollipop Jul 21, 2019

    elanglois, Jul 21, 2019 :
    Did you read the study?

    They didn't evaluate disk IO on a "fragmented" phone and then defrag it and retest. Instead they emulated a fragmented file system through an artificial write pattern and then tried to make claims about IO performance. First, the simulated write pattern in no way represents actual usage. Second, they completely filled the phone before deleting the files to create the storage holes for fragmented file creation.

    The idiots just triggered a rather bad garbage collection!

    Just because its a pretty PDF doesn't mean the person that made it is smart!
     

  6. Loveit Jelly Bean Jul 21, 2019

    Loveit, Jul 21, 2019 :
    This is great. 2 humans locking techy horns and I have no idea what either is really saying to be honest.

    An interesting read!
     

  7. anupritaisno1 KitKat Jul 24, 2019

    anupritaisno1, Jul 24, 2019 :
    Lineage is actually AOSP so using it is no different than an AOSP ROM

    There was a time back in the android N days when lineage mixed several things together on top of CAF but that's no longer the case

    Also if you see the commit author the commit clearly is coming from a purenexus ROM developer which is an AOSP ROM

    There is no reason for ROMs to not include the change

    Also I'd rather not use AOSP ROMs. Often these ROMs do not merge security patches correctly or merge incorrect tags. Users do not have the technical knowledge required to spot errors made while merging security patches

    In fact other than lineage and a few big name ROMs like DU almost every other ROM merges the wrong AOSP tag while merging security patches

    Kernel security patches? These people can't patch a ROM and you expect a kernel security patch from them. Almost all of these lie about security patches
     
    Last edited: Jul 24, 2019

  8. anupritaisno1 KitKat Jul 24, 2019

    anupritaisno1, Jul 24, 2019 :
    The important thing here is that there's no thing like a "modern Linux filesystem". They are all filesystem implementations for the Linux kernel. It is completely up to the filesystem how to manage and avoid fragmentation and not upto the kernel

    Android periodically deletes the system log but there are other sources huge files could come from and be slowly written to disk. One such example is video recording which does have the potential to produce large files

    F2FS seems to write to a new section every time a write occurs instead of overwriting an already used section. It then runs gc to free up older sections. That's not defragmentation
     

  9. Twowheeler Froyo Jul 24, 2019

    Twowheeler, Jul 24, 2019 :
    Without doing the script, wouldn't the same effect after a cache wipe (for whatever reason) be just hooking the phone to a charger right after and letting it charge for a longer time. This will trigger the optimization to start right?
     

  10. Intruder71 Lollipop Jul 24, 2019

    Intruder71, Jul 24, 2019 :
    Wrong..
     

  11. anupritaisno1 KitKat Jul 24, 2019

    anupritaisno1, Jul 24, 2019 :
    I got other results but they cannot be used as definitive evidence

    If you really do want to know what exactly happened I've seen people use f2fs for 2-3 years and their write speeds have fallen as low as 14mbps when their disk is at about 300mbps. If you really think f2fs fragmentation isn't a real thing maybe ask someone who was actually affected by it

    Most users do not keep phones for 2-3 years and replace their phone almost every year. People who use custom ROMs format their phones at the drop of a hat. There are few who don't and they are the ones who eventually face such issues
     

  12. anupritaisno1 KitKat Jul 24, 2019

    anupritaisno1, Jul 24, 2019 :
    No because there is no profile data generated to tell the runtime what needs to be optimised

    The speed-profile filter without a profile is the same as the quicken filter. You'll get some optimisation but you won't immediately return to the same level of optimisation unless you use the phone first
     

  13. Twowheeler Froyo Jul 24, 2019

    Twowheeler, Jul 24, 2019 :
    Got that, so it's best to run the script afterwards and not touch cache removal anymore after that. I did do a cache wipe a few days ago, so it's probably a good Idea to use the script you pointed out to get everything back to optimized again. Thought It wouldn't matter since you pointed out charging to 100% and letting the phone sit kicks the optimization into action. But not for every app apparently. Thanks!
     

  14. anupritaisno1 KitKat Jul 24, 2019

    anupritaisno1, Jul 24, 2019 :
    First post

    The cache still has to be compared against boot.oat in /system while booting

    Even without the commit it should be fine
     

  15. anupritaisno1 KitKat Jul 24, 2019

    anupritaisno1, Jul 24, 2019 :
    Google seems to be tired of this too

    https://github.com/LineageOS/android_frameworks_base/commit/7265abe77a76f848a316640b5da106e882bdbc8a

    There are other optimisations than just the cache and users didn't allow their devices to run these leading to extremely laggy devices

    It's not just the cache that is built during charging overnight
     

  16. Twowheeler Froyo Jul 24, 2019

    Twowheeler, Jul 24, 2019 :
    Got it, will do the script later and just use the phone normally. Lot to read an learn in this thread!

    Edit: ran the script on oneplus 6, finished within 5 minutes. First with the error, did it another time and finished without the error.

    Now to just use the device normally again. Curious about the effect, but it's good to know everything is the way it should be again
     
    Last edited: Jul 24, 2019

  17. elanglois Lollipop Jul 24, 2019

    elanglois, Jul 24, 2019 :
    No proof that the issue was fragmentation and not a GC issue
     

    anupritaisno1 likes this.
  18. elanglois Lollipop Jul 24, 2019

    elanglois, Jul 24, 2019 :
    But isn't. Or wasn't. Not seen it in awhile. Can't rememeber the last time. In any case, is it possible this comparison is new with Oreo or Pie?
     

  19. elanglois Lollipop Jul 24, 2019

    elanglois, Jul 24, 2019 :
    There are levels of optimization. Best to never wipe cache and always plug in your phone every night
     

  20. Panzer Kunst Donut Jul 24, 2019