LinuxForum.Fans
Тема

Ошибки в zram

Автор: I-Jurij 3 сообщений 2291 просмотров
#345724

Cкрипт в /etc/init.d:

text

#!/bin/bash

start() { # get the number of CPUs num_cpus=$(grep -c processor /proc/cpuinfo) # if something goes wrong, assume we have 1 [ "$num_cpus" != 0 ] || num_cpus=1 # set decremented number of CPUs last_cpu=$((num_cpus - 1)) #default Factor % = 90 change this value here or create /etc/default/zram FACTOR=90 #& put the above single line in /etc/default/zram with the value you want [ -f /etc/default/zram ] && source /etc/default/zram || true factor=$FACTOR # percentage # get the amount of memory in the machine memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ') mem_by_cpu=$(($memtotal/$num_cpus*$factor/100*1024)) if ! modprobe zram zram_num_devices=$num_cpus then echo -e "Your Kernel needs to be compiled with ZRAM support:" \ "\n\nDevice Drivers --> Staging Drivers --> Compressed RAM block device support (M)" \ "\nDevice Drivers --> Staging Drivers --> Dynamic compression of swap pages and clean pagecache pages (*)" \ "\n\nThe Liquorix Kernel (http://liquorix.net) has ZRAM support built in." exit 1 fi echo "zram devices probed successfully" # initialize the devices for i in $(seq 0 $last_cpu); do echo $mem_by_cpu > /sys/block/zram$i/disksize # Creating swap filesystems mkswap /dev/zram$i # Switch the swaps on swapon -p 100 /dev/zram$i done } stop() { # get the number of CPUs num_cpus=$(grep -c processor /proc/cpuinfo) # set decremented number of CPUs last_cpu=$((num_cpus - 1)) # Switching off swap for i in $(seq 0 $last_cpu); do if [ "$(grep /dev/zram$i /proc/swaps)" != "" ]; then swapoff /dev/zram$i sleep 1 fi done sleep 1 rmmod zram } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 3 start ;; *) echo "Usage: $0 {start|stop|restart}" RETVAL=1 esac exit $RETVAL

Вывод dmesg:
$ dmesg | grep zram
[ 23.672795] zram: module is from the staging directory, the quality is unknown, you have been warned.
[ 23.673975] zram: Creating 1 devices ...
[ 23.830019] Adding 403152k swap on /dev/zram0. Priority:100 extents:1 across:403152k SS
[ 23.833571] Buffer I/O error on device zram0, logical block 100788


Что можно сделать?

#345767
"I-Jurij" написал:
Что можно сделать?

Обновить ядро до версии 3.10.7
Вроде бы там это починили:
https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.7

text
commit 94bcc7deb8fed472360ad72ef3717c5409057fca
Author: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Date:   Sat Jun 22 17:21:00 2013 +0300

zram: allow request end to coincide with disksize commit 75c7caf5a052ffd8db3312fa7864ee2d142890c4 upstream. Pass valid_io_request() checks if request end coincides with disksize (end equals bound), only fail if we attempt to read beyond the bound. mkfs.ext2 produces numerous errors: [ 2164.632747] quiet_error: 1 callbacks suppressed [ 2164.633260] Buffer I/O error on device zram0, logical block 153599 [ 2164.633265] lost page write due to I/O error on zram0 Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Thomas Backlund <tmb@mageia.org> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Патч https://lkml.org/lkml/2013/6/22/50:

text
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 7538774..82c7202 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -180,7 +180,7 @@ static inline int valid_io_request(struct zram *zram, struct bio *bio)
end = start + (bio->bi_size >> SECTOR_SHIFT);
bound = zram->disksize >> SECTOR_SHIFT;
/* out of range range */
- if (unlikely(start >= bound || end >= bound || start > end))
+ if (unlikely(start >= bound || end > bound || start > end))
return 0;
/* I/O request is valid */
#345943

Спасибо, попробую.
А пока что я со вчерашнего вечера временно на 3.11 (ругалось правда при установке на отсутствие драйверов для radeon, но ничего, работает пока не хуже 3.2). Посмотрю, в 3.11, говорят, zswap по умолчанию.

Войдите или зарегистрируйтесь, чтобы ответить.