Skip to content

Per-cgroup swap file support

Yu Zhao cgroups linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 1 replySuperseded

Changes in v2 from the cover letter

- Fixed typos in comment and commit message
- Added rationale to this cover letter (Johannes Weiner)

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mm/swap: support per memory cgroup swapfilesDocumentation/cgroups/memory.txt include/linux/memcontrol.h include/linux/swap.h +6 more+331 -500 replies
2/3swap: do not store private swap files on swap_listmm/swapfile.c+47 -370 replies
3/3swap: Increase the max swap files to 8192 on x86_64arch/x86/include/asm/pgtable_64.h include/linux/swap.h+53 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] Per-cgroup swap file support

This series of patches adds support to configure a cgroup to swap to a particular file by using control file memory.swapfile.

Originally, cgroups share system-wide swap space and limiting cgroup swapping is not possible. This patchset solves the problem by adding mechanism that isolates cgroup swap spaces (i.e. per-cgroup swap file) so users can safely enable swap for particular cgroups without worrying about one cgroup uses up all swap space.

A value of "default" in memory.swapfile indicates that this cgroup should use the default, system-wide, swap files. A value of "none" indicates that this cgroup should never swap. Other values are interpreted as the path to a private swap file that can only be used by the owner (and its children).

The swap file has to be created and swapon() has to be done on it with SWAP_FLAG_PRIVATE, before it can be used. This flag ensures that the swap file is private and does not get used by others.

Changelog since v1:
- Fixed typos in comment and commit message
- Added rationale to this cover letter (Johannes Weiner)

Jamie Liu (1):
swap: do not store private swap files on swap_list

Suleiman Souhlal (2):
mm/swap: support per memory cgroup swapfiles
swap: Increase the max swap files to 8192 on x86_64

 Documentation/cgroups/memory.txt  |  15 ++
 arch/x86/include/asm/pgtable_64.h |  62 ++++++--
 include/linux/memcontrol.h        |   2 +
 include/linux/swap.h              |  45 +++---
 mm/memcontrol.c                   |  76 ++++++++++
 mm/memory.c                       |   3 +-
 mm/shmem.c                        |   2 +-
 mm/swap_state.c                   |   2 +-
 mm/swapfile.c                     | 307 +++++++++++++++++++++++++++++++-------
 mm/vmscan.c                       |   2 +-
 10 files changed, 422 insertions(+), 94 deletions(-)
Signature · 1 line
1.9.1.423.g4596e3a