Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
to DISCARD or not to DISCARD on modern NVMe drives
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1227

PostPosted: Wed Jun 06, 2018 4:21 pm    Post subject: to DISCARD or not to DISCARD on modern NVMe drives Reply with quote

Hello.

I have run into quite a lot of places where real-time discard/trim (used as ext4 mount option) is not recommended, even by ext4's own Theodore Ts'o:
https://forums.freebsd.org/threads/ssd-trim-maintenance.56951/#post-328912

Nevertheless, all of those articles were focusing on buggy SATA implementation of queueable TRIM command, forcing linux to revert to non-queueable version and leading to performance impact. NVMe drives were usually not mentioned.

Is there any info how successfully queueable TRIM command is implemented in modern NVMe drives like WD Black 3D, Samsung 970 EVO/PRO and similar?

Thx.
_________________
gentoo user
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 185

PostPosted: Wed Jun 06, 2018 6:18 pm    Post subject: Reply with quote

There's no new definitive info, just the old Intel NVMe docs from 2016 where it was also advised not to turn on discard but use the periodic fstrim. Same reasons that Ts'o mentioned, especially small discards being ignored thus ineffective.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54594
Location: 56N 3W

PostPosted: Wed Jun 06, 2018 8:39 pm    Post subject: Reply with quote

tnt,

The guts of the drive have not changed, only the interface to the outside world, so the guidance for SATA devices still applies.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Jun 06, 2018 8:41 pm    Post subject: Reply with quote

F2FS has discard turned on by default. https://www.kernel.org/doc/Documentation/filesystems/f2fs.txt
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1227

PostPosted: Thu Jun 07, 2018 6:41 am    Post subject: Reply with quote

After so many years, I would really expect those SSD controller developers to implement some kind of list/map of blocks eligible for TRIMing and to TRIM them later/when idle. :(

I guess that this is exactly what queueable TRIM should do, when implemented correctly.
_________________
gentoo user
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Thu Jun 07, 2018 2:38 pm    Post subject: Reply with quote

NeddySeagoon wrote:
The guts of the drive have not changed, only the interface to the outside world, so the guidance for SATA devices still applies.


https://nvmexpress.org/about/nvm-express-overview/

There are changes in the guts also, parallelism and queues are more important.

https://github.com/torvalds/linux/blob/master/drivers/nvme/host/pci.c

There are some Samsung/WD quirks, but those doesn't seem to be deallocate/trim related. I have used discard with ext4 on my Samsung SM961 without problems.
Back to top
View user's profile Send private message
tnt
Veteran
Veteran


Joined: 27 Feb 2004
Posts: 1227

PostPosted: Tue Jun 12, 2018 9:41 am    Post subject: Reply with quote

But, if online TRIM/DISCARD is not recommended, it's quite strange that Windows is still enabling it by default. :roll:

Windows 8/10 have scheduled TRIM via Disk Defragmenter (Optimize Drive), but real-time TRIM is still on if you do not kill it on your own.
_________________
gentoo user
Back to top
View user's profile Send private message
tholin
Apprentice
Apprentice


Joined: 04 Oct 2008
Posts: 205

PostPosted: Tue Jun 12, 2018 10:47 am    Post subject: Reply with quote

tnt wrote:
But, if online TRIM/DISCARD is not recommended, it's quite strange that Windows is still enabling it by default. :roll:

I guess Windows IO subsystem isn't as bad as Linux's. In Linux if there are a lot of discards queued up and the disk is slow at processing discards and some program calls sync() everything freeze until the queue has been processed. The same thing happens when offline trim (fstrim) is used but at least you can decide when to run it.

A patch was merged in 4.18 that will hopefully improve the situation if wtb is used.
https://github.com/torvalds/linux/commit/782f569774d7000e54ae9d680b0e4cd29b1c7ca3
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum