Modify

Opened 20 months ago

Last modified 19 months ago

#22666 new defect

zram doesn't work with lz4 on big endian machines

Reported by: jhalfmoon@… Owned by: developers
Priority: normal Milestone:
Component: kernel Version: Chaos Calmer 15.05
Keywords: zram lz4 Cc:

Description

To reproduce it:

opkg install kmod_zram swap-utils

swapoff /dev/zram0
rmmod zram
modprobe zram
echo lz4 > /sys/devices/virtual/block/zram0/comp_algorithm
echo $((2*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/zram0
swapon -p 10 /dev/zram0
swapon -s
cat /sys/block/zram0/comp_algorithm
dmesg | tail

The following will be logged:
[821241.390000] zram: Created 1 device(s) ...
[821242.430000] zram0: detected capacity change from 0 to 4194304
[821244.480000] zram: Decompression failed! err=-1, page=0
[821244.480000] Buffer I/O error on dev zram0, logical block 0, async page read

Apparently this is a known issue and even reported by none other than Greg Kroah-Hartman: https://lkml.org/lkml/2016/4/5/564

#=== System info:

root@router:~# cat /proc/version
Linux version 3.18.23 (buildbot@builder1) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r47269) ) #1 Sun Jan 31 18:39:35 CET 2016

root@router:~# cat /proc/cpuinfo
system type : Atheros AR9132 rev 2
machine : TP-LINK TL-WR1043ND
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 265.42
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

Attachments (0)

Change History (3)

comment:1 Changed 19 months ago by hojuruku

Works for me bro on trunk.

Hint if you want to create a new zram device you can do it using the hotadd feature not reloading the module. That might solve your problem. rtfm the zram.txt document bundled with the linux kernel.

https://www.kernel.org/doc/Documentation/blockdev/zram.txt

7) Add/remove zram devices


zram provides a control interface, which enables dynamic (on-demand) device
addition and removal.


In order to add a new /dev/zramX device, perform read operation on hot_add
attribute. This will return either new device's device id (meaning that you
can use /dev/zram<id>) or error code.


Example:

cat /sys/class/zram-control/hot_add
1


To remove the existing /dev/zramX device (where X is a device id)
execute

echo X > /sys/class/zram-control/hot_remove


`
cd /sys/block/zram1
echo 1 > reset
echo lz4 > comp_algorithm
echo 4096K > disksize
mkfs.ext2 -b 4096 /dev/zram1
mkdir /mnt/foo
mount -t ext4 /dev/zram1 /tmp/foo
`
And the filesytem works fine.
Besides you want to use lzo for swap and lz4 for mounting /tmp on ext4. I'm working on a patch for procd zram /tmp to use busybox only to get the job done. No block mount stuff.

comment:2 Changed 19 months ago by hojuruku

p.s same hardware as you.

root@wifi:/tmp# cat /proc/cpuinfo
system type : Atheros AR9132 rev 2
machine : TP-LINK TL-WR941ND
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 265.42
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available

comment:3 Changed 19 months ago by hojuruku

I have even tested this with PROCD mounting ZRAM with LZ4 and running /tmp on a running router. (new patch)

As far as Kernel 4.4 on the same hardware is concerned this issue doesn't exist. I vouch for it. Close the ticket.

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.