Skip to content

RFC make vm aware of zram-swap

Minchan Kim linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3zram: generalize swap_slot_free_notifyDocumentation/filesystems/Locking drivers/block/zram/zram_drv.c include/linux/blkdev.h +2 more+31 -150 replies
2/3mm: add swap_get_free hint for zraminclude/linux/blkdev.h mm/swapfile.c+44 -26 replies
3/3zram: add swap_get_free hintdrivers/block/zram/zram_drv.c+18 -010 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC 0/3] make vm aware of zram-swap

VM uses nr_swap_pages as one of information when it reclaims anonymous page because nr_swap_pages means how many freeable space in swap so VM is able to throttle swap out if it found there is no more space in swap.

But for zram-swap, there is size gap between virtual disksize and physical memory to be able to store compressed memory so nr_swap_pages is not correct parameter to throttle swap.

It causes endless anonymous reclaim(ie, swapout) even if there is no free space in zram-swap so it makes system unresponsive.

This patch adds new hint SWAP_GET_FREE so zram can return how many of freeable space to VM. With using that, VM can know whether zram is full and substract remained freeable space from nr_swap_pages to make it less than 0. IOW, from now on, VM sees there is no more space of zram so that it will stop anonymous reclaiming until swap_entry_free free a page which increases nr_swap_pages again.

With this patch, user will see OOM when zram-swap is full instead of hang with no response.

Minchan Kim (3):
zram: generalize swap_slot_free_notify
mm: add swap_get_free hint for zram
zram: add swap_get_free hint

 Documentation/filesystems/Locking |  7 ++----
 drivers/block/zram/zram_drv.c     | 36 +++++++++++++++++++++++++--
 include/linux/blkdev.h            |  8 ++++--
 mm/page_io.c                      |  7 +++---
 mm/swapfile.c                     | 52 +++++++++++++++++++++++++++++++++++----
 5 files changed, 93 insertions(+), 17 deletions(-)
Signature · 1 line
2.0.0