Skip to content

swap: allowing a more flexible DISCARD policy V2

Rafael Aquini linux-mm lkml 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 8 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2swap: discard while swapping only if SWAP_FLAG_DISCARD_PAGESinclude/linux/swap.h mm/swapfile.c+59 -96 replies
2/2swapon: allow a more flexible swap discard policysys-utils/swapon.8 sys-utils/swapon.c+77 -172 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchKOSAKI Motohiro
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/02] swap: allowing a more flexible DISCARD policy V2

Considering the use cases where the swap device supports discard:
a) and can do it quickly;
b) but it's slow to do in small granularities (or concurrent with other I/O);
c) but the implementation is so horrendous that you don't even want to send one down;

And assuming that the sysadmin considers it useful to send the discards down at all, we would (probably) want the following solutions:

i. do the fine-grained discards for freed swap pages, if device is

     capable of doing so optimally;
 ii. do single-time (batched) swap area discards, either at swapon 
     or via something like fstrim (not implemented yet);

iii. allow doing both single-time and fine-grained discards; or
iv. turn it off completely (default behavior)

As implemented today, one can only enable/disable discards for swap, but one cannot select, for instance, solution (ii) on a swap device like (b) even though the single-time discard is regarded to be interesting, or necessary to the workload because it would imply (1), and the device is not capable of performing it optimally.

This patchset addresses the scenario depicted above by introducing a way to ensure the (probably) wanted solutions (i, ii, iii and iv) can be flexibly flagged through swapon(8) to allow a sysadmin to select the best suitable swap discard policy accordingly to system constraints.

Changeset from V1:
01 (kernel) swap: discard while swapping only if SWAP_FLAG_DISCARD_PAGES
* ensure backwards compatibility with older swapon(8) releases; (mkosaki)

02 (util-linux) swapon: allow a more flexible swap discard policy
* introduce discard policy selector as an optional argument of --discard option;
* rename user-visible discard policy names; (mkosaki, karel, jmoyer)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>