mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
zram-swap: remove the compression streams settings
Zram switched to per-cpu compression streams since Linux 4.7 [1]. Drop the irrelevant configuration (no-op). [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/block/zram?h=v4.7&id=43209ea2d17aae1540d4e28274e36404f72702f2 Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
This commit is contained in:
parent
c29f6121fd
commit
116191eddf
@ -97,19 +97,6 @@ zram_comp_algo()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
zram_comp_streams()
|
|
||||||
{
|
|
||||||
local dev="$1"
|
|
||||||
local logical_cpus=$( grep -ci "^processor" /proc/cpuinfo )
|
|
||||||
[ $logical_cpus -gt 1 ] || return 1
|
|
||||||
local zram_comp_streams="$( uci -q get system.@system[0].zram_comp_streams )"
|
|
||||||
[ -n "$zram_comp_streams" ] && [ "$zram_comp_streams" -le "$logical_cpus" ] || zram_comp_streams=$logical_cpus
|
|
||||||
if [ -e /sys/block/$( basename $dev )/max_comp_streams ]; then
|
|
||||||
logger -s -t zram_comp_streams -p daemon.debug "Set max compression streams to '$zram_comp_streams' for zram '$dev'"
|
|
||||||
echo $zram_comp_streams > /sys/block/$( basename $dev )/max_comp_streams
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#print various stats info about zram swap device
|
#print various stats info about zram swap device
|
||||||
zram_stats()
|
zram_stats()
|
||||||
{
|
{
|
||||||
@ -121,7 +108,6 @@ zram_stats()
|
|||||||
printf "%-25s - %s\n" "Block device" $zdev
|
printf "%-25s - %s\n" "Block device" $zdev
|
||||||
awk '{ printf "%-25s - %d MiB\n", "Device size", $1/1024/1024 }' <$zdev/disksize
|
awk '{ printf "%-25s - %d MiB\n", "Device size", $1/1024/1024 }' <$zdev/disksize
|
||||||
printf "%-25s - %s\n" "Compression algo" "$(cat $zdev/comp_algorithm)"
|
printf "%-25s - %s\n" "Compression algo" "$(cat $zdev/comp_algorithm)"
|
||||||
printf "%-25s - %s\n" "Compression streams" "$( cat $zdev/max_comp_streams)"
|
|
||||||
|
|
||||||
awk 'BEGIN { fmt = "%-25s - %.2f %s\n"
|
awk 'BEGIN { fmt = "%-25s - %.2f %s\n"
|
||||||
fmt2 = "%-25s - %d\n"
|
fmt2 = "%-25s - %d\n"
|
||||||
@ -179,7 +165,6 @@ start()
|
|||||||
|
|
||||||
zram_reset "$zram_dev" "enforcing defaults"
|
zram_reset "$zram_dev" "enforcing defaults"
|
||||||
zram_comp_algo "$zram_dev"
|
zram_comp_algo "$zram_dev"
|
||||||
zram_comp_streams "$zram_dev"
|
|
||||||
echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
|
echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
|
||||||
/sbin/mkswap "$zram_dev"
|
/sbin/mkswap "$zram_dev"
|
||||||
/sbin/swapon -d $zram_priority "$zram_dev"
|
/sbin/swapon -d $zram_priority "$zram_dev"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user