dslreports logo
 
    All Forums Hot Topics Gallery
spc
uniqs
22

koitsu
MVM
join:2002-07-16
Mountain View, CA
Humax BGW320-500

koitsu to Ctrl Alt Del

MVM

to Ctrl Alt Del

Re: [WIN8] SSDs - using Intel Toolbox or W8's drive Optimizer?

said by Ctrl Alt Del:

Absolutely excellent advice all around, but there's one thing you're not entirely correct on:

said by koitsu:

Now, about the Windows 8 "Optimize Drives" program -- you should not use this on SSDs. EVER. This is just a renamed disk defragmentation utility, and that will absolutely hurt the performance of your SSD (the FTL map will eventually become full with all the LBA tracking it has to do, and drive performance will become slower and slower over time). The OS's I/O abstraction layer already does TRIM on file deletes or resizes (truncation) -- do not let this hogwash chart make you think otherwise. You can (and should) use the Windows 8 "Optimize Drives" program with MHDDs, but not SSDs.

If Windows 8 determines that you have a SSD, it will not defragment it. All it will do is run TRIM if the amount of dirty blocks exceeds a threshold. Otherwise, Windows wont do anything to the drive.

Good to know (about it not attempting defragmentation on an SSD) -- thank you!

As for the Windows 8 Optimiser doing TRIM -- this is completely/entirely superfluous, as the filesystem and I/O abstraction layer already does automatically this upon file deletion and file truncation.

I get the impression that the Windows kernel (and/or NTFS layer) has a queueing system of sorts when it comes to issuing TRIM for LBA ranges, so it's possible the Windows 8 Optimiser might force immediate processing/completion of that queue -- but there's absolutely zero point/gain to doing that since the OS will get to it as needed.

This is one of those situations where guys like Mark Russinovich need to appear and provide actual low-level details of both application and kernel behaviour. I really don't trust what's written on MSDN with regards to what all the Optimiser truly does.

Ctrl Alt Del
Premium Member
join:2002-02-18

Ctrl Alt Del

Premium Member

said by koitsu:

As for the Windows 8 Optimiser doing TRIM -- this is completely/entirely superfluous, as the filesystem and I/O abstraction layer already does automatically this upon file deletion and file truncation.

The OS only marks bits as ready for deletion and sends a TRIM command to the SSD. The SSD firmware is responsible for keeping track of the dirty bits and what to do with them. The firmware and garbage collection on different SSDs will do different things with the dirty bits. All the Windows 8 Optimize Drive utility does is explicitly send another TRIM for the entire SSD volume, essentially asking the SSD's firmware to clean the whole thing. In actual use it is probably not needed, but since Optimize Drives is only issuing a command to the SSD, and the SSD decides whether to actually do anything, it shouldn't be a concern.

Windows 7: NTFS will send TRIM hints when files are deleted or moved from those regions; SSDs consume these hints to perform a cleanup in the background called as 'reclaim' that helps them get ready for next writes. The SSD may choose to perform the optimization immediately, store the information for later optimization or throw away the hint completely and not use it for optimization since it does not have time to perform this optimization immediately.

Windows 8: Still does what Windows 7 did above, but the Optimize Drives feature sends a complete set of trim hints for the entire volume again - this is done at idle time and helps to allow for SSDs that were unable to cleanup earlier - a chance to react to these hints and cleanup and optimizer for the best performance.

And most importantly, it does not do a traditional defrag (moving files to optimizer there location for space and performance) on SSDs.

SOURCE: »superuser.com/questions/ ··· indows-8

koitsu
MVM
join:2002-07-16
Mountain View, CA
Humax BGW320-500

koitsu

MVM

It seems to me the MSFT individual who provided the write-up there does not entirely understand how SSDs work -- I can tell from his explanation he is not familiar with ATA protocol. I'm one of those weirdos who actually does ATA protocol stuff (ATA device drivers are something I have poked at, usually alongside kernel folks).

Some of what he said is correct, but other things are questionable. It get the impression he's looking at it from an ABI perspective, as in "I helped write the Windows 8 Optimiser, and it behaves like this, because I call a magical Win32 I/O ABI function and it does magical things". There just isn't enough low-level technical detail in what he's describing. It's loads better than what you'd find on some enthusiast forum, sure. But for example his claim that TRIM "causes things to happen in the background" is somewhat incorrect.

This whole topic would require quite possibly an hour long interview / discussion with me, in probably audio and video form (with a whiteboard), because it would take me days to really explain how it all works. One of the most common misunderstandings/misconceptions is what "garbage collection" actually is, what it does on an SSD, and how/when it does it, and how TRIM works with it.

One thing I did want to get out of the way though: you cannot issue a DATA SET MANAGEMENT (ATA command 0x06) (commonly known as TRIM) CDB for the entire LBA range on a drive. The CDB only supports a 16-bit field for length/size so only up to 65536 LBAs can be TRIM'd with a single CDB. The LBA size is always 512, so the maximum amount you can TRIM linearly in a single CDB is 33,554,432 bytes or ~32MBytes -- see T13/2015-D rev 1a ATA8-ACS specification for details. Meaning: the OS/storage driver must issue multiple CDBs to the drive when informing the drive those LBA ranges are no longer in use / can be free'd from the FTL map. And as I'm sure you know, files are not necessarily stored in contiguous LBA ranges (depends on many things (file size, available space, and allocation algorithms per that filesystem model)), so in many cases an OS can end up submitting thousands of CDBs to an SSD when doing something like deleting a directory with many files in it.

Ctrl Alt Del
Premium Member
join:2002-02-18

Ctrl Alt Del

Premium Member

I don't know much more about the inner workings of the Windows 8 Optimize Drive feature, I only have what I could find online. There's a lot of junk out there that don't actually describe the technical underpinnings of things. Really the most important thing was: Windows 8 is smart enough to know not to defrag a SSD.

My knowledge of TRIM and garbage collection is limited. I've read most of Anandtech's reports in curiosity, but can only absorb so much. Any good places to start?

koitsu
MVM
join:2002-07-16
Mountain View, CA
Humax BGW320-500

koitsu

MVM

said by Ctrl Alt Del:

I don't know much more about the inner workings of the Windows 8 Optimize Drive feature, I only have what I could find online. There's a lot of junk out there that don't actually describe the technical underpinnings of things. Really the most important thing was: Windows 8 is smart enough to know not to defrag a SSD.

Yeah, agreed. And I again thank you for bringing that fact up since I didn't know of it. Likewise I appreciate Microsoft inhibiting defragmentation if the device is an SSD. Thumbs up on both accounts!
said by Ctrl Alt Del:

My knowledge of TRIM and garbage collection is limited. I've read most of Anandtech's reports in curiosity, but can only absorb so much. Any good places to start?

That's a tricky one, because SSDs are still an incredibly new technology and continues to rapidly change without any disclosure of the internals of what's changed (for example I'm used to the classic method of there being only one translation layer being involved, but newer drives have two TLs that serve two different purposes); the MHDD industry operates the same way. What we usually get these days is marketing-driven explanations of technology, not explanations provided by actual engineers.

If I come across some resources or articles that are technical and beneficial I'll be sure to post them here, but for now all I can really recommend is that you try to read as many of the existing ones online and follow up with what's on Wikipedia. Sorry that I can't be of more help in this regard right now.