vaeth / zram-init

A wrapper script for the zram linux kernel module with zsh and openrc support
http://www.mathematik.uni-wuerzburg.de/~vaeth/download/index.html#zram-init
79 stars 26 forks source link

adding discard option as "sane" default mount option #3

Closed karolherbst closed 9 years ago

karolherbst commented 9 years ago

If you use really big zrams, like I used 11GB for portage compilation, the filesystem contains random data over the time and begin to use a lot of RAM. the "discard" mount option removes files on delete from the filesystem entirely instead of just removing the reference, making the memory used by the zram device less.

I think discard is supported since linux-2.6.33 and ext4.

If this option won't be added as a default options, maybe a notice in the config file would be nice (something like: if you want to use big devices, please use ext4 with discard).

This would effect the openrc conf.d file and the systemd service files.

vaeth commented 9 years ago

I think discard is supported since linux-2.6.33 and ext4

Whether ext4 supports "discard" is not the point: The important question is whether zram reacts on a discard request from ext4, since otherwise the "discard" option just costs time and helps nothing.

It seems that zram supports "discard" since linux-3.18, so indeed it makes sense to use it as a new default option. Thanks for pointing out.

vaeth commented 9 years ago

Correction: It seems it is already supported since linux-3.15

karolherbst commented 9 years ago

Yeah, it was working for me since I start to use zram, which should be around 3.16 or something.

karolherbst commented 9 years ago

Allthough I don't know the performance impact off discard, so maybe it doesn't make sense to enable it, if you only have a really small device.

vaeth commented 9 years ago

Fixed in v3.2

karolherbst commented 9 years ago

thanks