zram: auto add new devices on demand
Subsystems (3)
PATCH v3 1/1 zram: auto add new devices on demand
From: Timofey Titovets <[email protected]>
This add supporting of auto allocate new zram devices on demand, like loop devices
This working by following rules:
- Pre create zram devices specified by num_device
- if all device already in use -> add new free device
From v1 -> v2:
Delete useless variable 'ret', added documentation for explain new zram behaviour
From v2 -> v3
Delete logic to destroy not used devices, for avoid concurrency issues Code refactoring for made patch small and clean as possible Patch can pass the test:
#!/bin/sh
modprobe zram
while true; do
echo 10485760 > /sys/block/zram0/disksize& echo 1 > /sys/block/zram0/reset&
done
Please pull from:
https://github.com/Nefelim4ag/linux.git
Tested on 3.15.5-2-ARCH, can be applied on any kernel version
after this patch 'zram: add LZ4 compression support' - https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=6e76668e415adf799839f0ab205142ad7002d260
---
Documentation/blockdev/zram.txt +3 -0
@@ -21,6 +21,9 @@ Following shows a typical sequence of steps for using zram. This creates 4 devices: /dev/zram{0,1,2,3} (num_devices parameter is optional. Default: 1) + If all device in use kernel will create new zram device + (between num_devices and 31) + 2) Set max number of compression streams Compression backend may use up to max_comp_streams compression streams, thus allowing up to max_comp_streams concurrent compression operations.
drivers/block/zram/zram_drv.c +39 -3
101 lines not on this page · raw message