aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorVinayak Menon <vinmenon@codeaurora.org>2015-02-25 19:43:59 +0530
committerSimon Shields <keepcalm444@gmail.com>2016-06-12 21:20:18 +1000
commita6ce37fb73dce407da9d7d1d03408602be84177c (patch)
tree85ca3a46532a4f2683cb4eab40130ad5707a094e /drivers/block
parentd997b41417d94c22baaabd8d84a6a4f1e2e93fb9 (diff)
downloadkernel_samsung_smdk4412-a6ce37fb73dce407da9d7d1d03408602be84177c.zip
kernel_samsung_smdk4412-a6ce37fb73dce407da9d7d1d03408602be84177c.tar.gz
kernel_samsung_smdk4412-a6ce37fb73dce407da9d7d1d03408602be84177c.tar.bz2
mm: swap: don't delay swap free for fast swap devices
There are couple of issues with swapcache usage when ZRAM is used as swap device. 1) Kernel does a swap readahead which can be around 6 to 8 pages depending on total ram, which is not required for zram since accesses are fast. 2) Kernel delays the freeing up of swapcache expecting a later hit, which again is useless in the case of zram. 3) This is not related to swapcache, but zram usage itself. As mentioned in (2) kernel delays freeing of swapcache, but along with that it delays zram compressed page free also. i.e. there can be 2 copies, though one is compressed. This patch addresses these issues using two new flags QUEUE_FLAG_FAST and SWP_FAST, to indicate that accesses to the device will be fast and cheap, and instructs the swap layer to free up swap space agressively, and not to do read ahead. Change-Id: I5d2d5176a5f9420300bb2f843f6ecbdb25ea80e4 Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org> Signed-off-by: D. Andrei Măceș <dmaces@nd.edu> Conflicts: include/linux/blkdev.h include/linux/swap.h mm/swap_state.c mm/swapfile.c Conflicts: include/linux/blkdev.h
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/zram/zram_drv.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 803e7a2..7040165 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -936,6 +936,7 @@ static int create_device(struct zram *zram, int device_id)
zram->disk->private_data = zram;
snprintf(zram->disk->disk_name, 16, "zram%d", device_id);
+ __set_bit(QUEUE_FLAG_FAST, &zram->queue->queue_flags);
/* Actual capacity set using syfs (/sys/block/zram<id>/disksize */
set_capacity(zram->disk, 0);
/* zram devices sort of resembles non-rotational disks */