Am 22.04.2014 19:17, schrieb Jóhann B. Guðmundsson:
On 04/22/2014 01:38 PM, Josh Boyer wrote:
> I have a rawhide VM here too, it has nothing related to zram
> configuration, and the module isn't loaded.
Nor should it be it's going to take us sometime to implement this correctly into the
distribution and arguably that module should be packaged seperatly in a zram package
why do you need a sub-package?
if it is not loaded all is fine
today i started using zram on testing and development virtual machines
maybe that it was loaded automatically is already fixed, the first
testing was a realy Rawhide 3.15 kernel and after that i blacklisted it
but for now still keep the "rmmod" before re-load the module
below you have all needed for zram working and i have currently
besides the F20 development-servers a Rawhide VM with 256 MB
RAM and with zram it survives even "yum reinstall \*"
______________________________________________________________
[root@testserver:~]$ cat /usr/lib/systemd/system/zram.service
[Unit]
Description=Enable compressed swap in memory using zram
After=multi-user.target
[Service]
RemainAfterExit=yes
ExecStart=/usr/sbin/zramstart
ExecStop=/usr/sbin/zramstop
Type=oneshot
[Install]
WantedBy=multi-user.target
______________________________________________________________
[root@testserver:~]$ cat /etc/sysconfig/zram
FACTOR=25
______________________________________________________________
[root@testserver:~]$ cat /etc/modprobe.d/disable-zram.conf
blacklist zram
______________________________________________________________
[root@testserver:~]$ cat /usr/sbin/zramstart
#!/usr/bin/bash
num_cpus=$(grep -c processor /proc/cpuinfo)
[ "$num_cpus" != 0 ] || num_cpus=1
last_cpu=$((num_cpus - 1))
FACTOR=20
[ -f /etc/sysconfig/zram ] && source /etc/sysconfig/zram || true
factor=$FACTOR
memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ')
mem_by_cpu=$(($memtotal/$num_cpus*$factor/100*1024))
/usr/sbin/rmmod zram 2> /dev/null > /dev/null
/usr/sbin/modprobe -q zram num_devices=$num_cpus 2> /dev/null > /dev/null
for i in $(seq 0 $last_cpu); do
echo $mem_by_cpu > /sys/block/zram$i/disksize
/usr/sbin/mkswap /dev/zram$i
/usr/sbin/swapon -p 100 /dev/zram$i
done
______________________________________________________________
[root@testserver:~]$ cat /usr/sbin/zramstop
#!/usr/bin/bash
for i in $(grep '^/dev/zram' /proc/swaps | awk '{ print $1 }'); do
/usr/sbin/swapoff "$i"
done
if grep -q "^zram " /proc/modules; then
sleep 1
/usr/sbin/rmmod zram
fi