IIRC some implementations of discard/trim can impair performance if
done as part of normal filesystem operations. On those systems a
periodic call to fstrim to do the cleanup as a batch job is more
appropriate. If you wish to use the runtime discard feature in ext4
you can create a /etc/fstab that looks something like the following:
LABEL=ROOT / ext4 discard 0 1