[linux-lvm] swap on lvm cache
list at xenhideout.nl
Wed Apr 27 10:32:29 UTC 2016
Zdenek Kabelac schreef op 27-04-2016 8:38:
> Yes, it would be seriously bad idea to use 'swap' on cached LV...
> There are already unsolved issues with plain devices and swapping :)
> and you want to put caching logic into this stack.
I just think it would never promote it to the cache ;-). Unless the same
blocks are written repeatedly with different memory. But typically every
write is followed by a read. I don't think the same regions of swap are
constantly reused. If your system is not heavily swapping, usually it
would be rather stable. On heavy swap though you might find that the
cache might start to promote it, but it also means the values constantly
Question: if a block has been promoted through reading (for example)
(since reading promotion is usually lower (faster)) and is then written
to, does this mean the cache for it is updated and then written through
(or back)? I suppose it would. Let's assume that is the only sensible
That means you could have swap blocks promoted due to heavy swapping
(and hence reading) and if you have writeback, it would still make a
modicum of sense since then it would actually cause hits to go to the
cache instead of the slower disk.
I mean I could test it. I could just load a few programs heavy on
memory, so that I can fully fill my cache (swap I mean) and then I could
start alt-tabbing through these programs as a test. And then I would
need statistics on lvmcache hits. You say there are issues but I am more
than willing to crash my system for it :p.
For example, swap on thin LVM works fine. Although the swap filesystem
is not cleared with swapoff. This can be changed with the --discard
option, and then it is cleared.
Any discarded swap would instantly discard it from the LVM cache,
likely, but not necessarily. If that happened then the promotion counter
would never rise.
It is hard to find information on LVMcache. I don't know enough about
dmcache to know its relation. I will just ask two short questions in a
More information about the linux-lvm