Accepting request 1003552 from filesystems
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/1003552 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd-zram-service?expand=0&rev=4
This commit is contained in:
commit
f9278522db
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Sep 7 00:00:00 CEST 2022 - dsterba@suse.cz
|
||||||
|
|
||||||
|
- disable multi-zram devices (deprecated, not necessary since 4.7)
|
||||||
|
- change compression to zstd
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Dec 13 16:18:04 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
|
Mon Dec 13 16:18:04 UTC 2021 - Johannes Segitz <jsegitz@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package systemd-zram-service
|
# spec file for package systemd-zram-service
|
||||||
#
|
#
|
||||||
# Copyright (c) 2021 SUSE LLC
|
# Copyright (c) 2022 SUSE LLC
|
||||||
# Copyright (c) 2012-2018 Malcolm J Lewis <malcolmlewis@opensuse.org>
|
# Copyright (c) 2012-2018 Malcolm J Lewis <malcolmlewis@opensuse.org>
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
12
zramswapoff
12
zramswapoff
@ -1,16 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# get the number of CPUs
|
|
||||||
num_cpus=$(grep -c processor /proc/cpuinfo)
|
|
||||||
|
|
||||||
# set decremented number of CPUs
|
|
||||||
decr_num_cpus=$((num_cpus - 1))
|
|
||||||
|
|
||||||
# Switching off swap
|
# Switching off swap
|
||||||
for i in $(seq 0 $decr_num_cpus); do
|
swapoff /dev/zram0
|
||||||
if [ "$(grep /dev/zram$i /proc/swaps)" != "" ]; then
|
|
||||||
swapoff /dev/zram$i
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
rmmod zram
|
rmmod zram
|
||||||
|
32
zramswapon
32
zramswapon
@ -1,34 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# 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
|
|
||||||
decr_num_cpus=$((num_cpus - 1))
|
|
||||||
|
|
||||||
# get the amount of memory in the machine
|
# get the amount of memory in the machine
|
||||||
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
|
mem_total_kb=$(grep MemTotal /proc/meminfo | grep -E --only-matching '[[:digit:]]+')
|
||||||
mem_total=$((mem_total_kb * 1024))
|
mem_total=$((mem_total_kb * 1024))
|
||||||
|
|
||||||
# load dependency modules
|
# load the dependency module
|
||||||
#modprobe zram zram_num_devices=$num_cpus
|
modprobe zram
|
||||||
# Determine module parm
|
|
||||||
mod_parm=$(modinfo zram |grep parm |tr -s " " |cut -f2 -d ":")
|
|
||||||
modprobe zram $mod_parm=$num_cpus
|
|
||||||
|
|
||||||
# initialize the devices
|
# initialize the device with zstd compression algorithm
|
||||||
for i in $(seq 0 $decr_num_cpus); do
|
echo zstd > /sys/block/zram0/comp_algorithm;
|
||||||
echo $((mem_total / num_cpus)) > /sys/block/zram$i/disksize
|
echo $mem_total > /sys/block/zram0/disksize
|
||||||
done
|
|
||||||
|
|
||||||
# Creating swap filesystems
|
# Creating the swap filesystem
|
||||||
for i in $(seq 0 $decr_num_cpus); do
|
mkswap /dev/zram0
|
||||||
mkswap /dev/zram$i
|
|
||||||
done
|
|
||||||
|
|
||||||
# Switch the swaps on
|
# Switch the swaps on
|
||||||
for i in $(seq 0 $decr_num_cpus); do
|
swapon -p 100 /dev/zram0
|
||||||
swapon -p 100 /dev/zram$i
|
|
||||||
done
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user