Reply to post: Re: Do they still do it? @MattUK

Apple: You can't sue us for slowing down your iPhones because you, er, invited us into, uh, your home... we can explain

Peter Gathercole Silver badge

Re: Do they still do it? @MattUK

Even in these days of FSTRIM being in the Android filesystem handling, flash memory handling still causes slowdowns as a device ages.

Because of the way flash memory is emptied (erased, in large allocation units which are multiples of the filesystem block size), there is a preference built in for it to mark the data deleted, but not actually erase and re-use it. This is because it's probably going to have to shuffle data in the rest of the allocation unit around before it can erase the allocation unit. The more flash RAM you have, the longer it will take to use it all and get to this point.

So all the time that you have still-to-be used flash memory, the OS will be quite speedy.

As soon as almost all of the empty flash memory allocation units have been used, the OS has to do some serious housekeeping to shuffle all of the data out of an allocation unit, so it can be erased prior to it being re-used. AFAIK, this is deferred until the last possible time. at which point the performance will hit a brick wall.

FSTRIM was supposed to be used to prevent this slowdown, but I get the impression that when it was introduced in Android, it didn't actually make a huge difference, IMHO.

When you wipe the phone and re-flash the original image, it does a bulk erase of the entire flash memory, after which it will run quick again, and start the whole process over.

In flash SSDs rather than phone memory, because the flash controller is allowed to consume power when the storage device is idle (which a phone won't do, in order to increase battery life), it spends it's idle time performing the housekeeping early, to make sure that you get maximum performance when it is needed.

This is done at a controller level, as there is block address renumbering going on (for wear leveling and to overcome a process called write disturbance, and also to allow for spare blocks to extend the lifetime of the device), so the data can be copied into a new allocation unit without the OS or filesystem being aware that the data is now in a different portion of the memory.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon