Skip to content

Commit 3f52ed6

Browse files
committed
v2021.12.2
- Added links to README, including XDA thread. - Android only: delay initialization (90 seconds after the emulated storage is > - Enhanced flashable zip generator - Fixed typo in README. - General optimizations - Updated default config (removed vfs_cache_pressure=200 tweak).
1 parent 4a4841d commit 3f52ed6

File tree

9 files changed

+51
-31
lines changed

9 files changed

+51
-31
lines changed

META-INF/com/google/android/update-binary

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ patch_cfg() {
2020
if [ $config_ver -lt 0202110290 ]; then
2121
sed -i -e '1iconfig_ver=202110290\n' -e '/^comp_a/s/=.*/=auto/' -e '/^vm=/s/e=200\"/e=200 page-cluster=0\"/' $cfg
2222
fi
23-
[ $config_ver -lt 0202111230 ] && sed -i -e '/^config_ver=/s/=.*/=202111230/' -e 's/ vfs_cache_pressure=200//' $cfg
23+
[ $config_ver -lt 0202112020 ] && sed -i -e '/^config_ver=/s/=.*/=202112020/' -e 's/ vfs_cache_pressure=200//' $cfg
2424
fi
2525
else
2626
install -m 644 $src/zram-swap-manager.conf $cfg

README.html

+11-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ <h2 id="config">Config</h2>
7979
<h2 id="default-config">Default Config</h2>
8080
<pre><code>config_ver=202111230 # used for patching; do not modify!
8181

82-
comp_algorithm=auto # [auto] -&gt; zstd (288) | lz4 (210) | lzo-rle (212) | lzo (2011)
82+
comp_algorithm=auto # [auto] -&gt; zstd (288) | lz4 (210) | lzo-rle (212) | lzo (211)
8383
comp_ratio=210 # [210], irrelevant when comp_algorithm=auto
8484
mem_percent=33 # [33], memory limit
8585

@@ -161,12 +161,17 @@ <h2 id="benchmarks">Benchmarks</h2>
161161
</tr>
162162
</tbody>
163163
</table>
164-
<h2 id="donations">Donations</h2>
164+
<h2 id="links">Links</h2>
165165
<ul>
166-
<li><a href="https://app.airtm.com/send-or-request/send">Airtm, username: ivandro863auzqg</a></li>
167-
<li><a href="https://liberapay.com/vr25/">Liberapay</a></li>
168-
<li><a href="https://patreon.com/vr25/">Patreon</a></li>
169-
<li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;[email protected]&amp;lc=US&amp;item_name=VR25+is+creating+free+and+open+source+software.+Donate+to+suppport+their+work.&amp;no_note=0&amp;cn=&amp;currency_code=USD&amp;bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">PayPal or Credit/Debit Card</a></li>
166+
<li><a href="https://app.airtm.com/send-or-request/send">Donate - Airtm, username: ivandro863auzqg</a></li>
167+
<li><a href="https://liberapay.com/vr25">Donate - Liberapay</a></li>
168+
<li><a href="https://patreon.com/vr25">Donate - Patreon</a></li>
169+
<li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&amp;[email protected]&amp;lc=US&amp;item_name=VR25+is+creating+free+and+open+source+software.+Donate+to+suppport+their+work.&amp;no_note=0&amp;cn=&amp;currency_code=USD&amp;bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">Donate - PayPal or Credit/Debit Card</a></li>
170+
<li><a href="https://fb.me/vr25xda">Facebook Page</a></li>
171+
<li><a href="https://t.me/vr25_xda">Telegram Channel</a></li>
172+
<li><a href="https://t.me/vr25xda">Telegram Profile</a></li>
173+
<li><a href="https://github.com/vr-25/zram-swap-manager">Upstream Repository</a></li>
174+
<li><a href="">XDA Thread</a></li>
170175
</ul>
171176

172177
</body>

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
## Default Config
4444
config_ver=202111230 # used for patching; do not modify!
4545

46-
comp_algorithm=auto # [auto] -> zstd (288) | lz4 (210) | lzo-rle (212) | lzo (2011)
46+
comp_algorithm=auto # [auto] -> zstd (288) | lz4 (210) | lzo-rle (212) | lzo (211)
4747
comp_ratio=210 # [210], irrelevant when comp_algorithm=auto
4848
mem_percent=33 # [33], memory limit
4949

@@ -76,8 +76,14 @@
7676
| snappy 1.1.4 | 2.091 | 530 MB/s | 1800 MB/s |
7777
| lzf 3.6 -1 | 2.077 | 400 MB/s | 860 MB/s |
7878

79-
## Donations
80-
- [Airtm, username: ivandro863auzqg](https://app.airtm.com/send-or-request/send)
81-
- [Liberapay](https://liberapay.com/vr25/)
82-
- [Patreon](https://patreon.com/vr25/)
83-
- [PayPal or Credit/Debit Card](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&lc=US&item_name=VR25+is+creating+free+and+open+source+software.+Donate+to+suppport+their+work.&no_note=0&cn=&currency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted)
79+
## Links
80+
81+
- [Donate - Airtm, username: ivandro863auzqg](https://app.airtm.com/send-or-request/send)
82+
- [Donate - Liberapay](https://liberapay.com/vr25)
83+
- [Donate - Patreon](https://patreon.com/vr25)
84+
- [Donate - PayPal or Credit/Debit Card](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&lc=US&item_name=VR25+is+creating+free+and+open+source+software.+Donate+to+suppport+their+work.&no_note=0&cn=&currency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted)
85+
- [Facebook Page](https://fb.me/vr25xda)
86+
- [Telegram Channel](https://t.me/vr25_xda)
87+
- [Telegram Profile](https://t.me/vr25xda)
88+
- [Upstream Repository](https://github.com/vr-25/zram-swap-manager)
89+
- [XDA Thread](https://forum.xda-developers.com/t/zram-swap-manager-for-android-and-gnu-linux-systems.4352797)

customize.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ patch_cfg() {
2020
if [ $config_ver -lt 0202110290 ]; then
2121
sed -i -e '1iconfig_ver=202110290\n' -e '/^comp_a/s/=.*/=auto/' -e '/^vm=/s/e=200\"/e=200 page-cluster=0\"/' $cfg
2222
fi
23-
[ $config_ver -lt 0202111230 ] && sed -i -e '/^config_ver=/s/=.*/=202111230/' -e 's/ vfs_cache_pressure=200//' $cfg
23+
[ $config_ver -lt 0202112020 ] && sed -i -e '/^config_ver=/s/=.*/=202112020/' -e 's/ vfs_cache_pressure=200//' $cfg
2424
fi
2525
else
2626
install -m 644 $src/zram-swap-manager.conf $cfg

install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ patch_cfg() {
2020
if [ $config_ver -lt 0202110290 ]; then
2121
sed -i -e '1iconfig_ver=202110290\n' -e '/^comp_a/s/=.*/=auto/' -e '/^vm=/s/e=200\"/e=200 page-cluster=0\"/' $cfg
2222
fi
23-
[ $config_ver -lt 0202111230 ] && sed -i -e '/^config_ver=/s/=.*/=202111230/' -e 's/ vfs_cache_pressure=200//' $cfg
23+
[ $config_ver -lt 0202112020 ] && sed -i -e '/^config_ver=/s/=.*/=202112020/' -e 's/ vfs_cache_pressure=200//' $cfg
2424
fi
2525
else
2626
install -m 644 $src/zram-swap-manager.conf $cfg

service.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/system/bin/sh
22
log=/dev/.vr25/zram-swap-manager/service.log
33
mkdir -p ${log%/*}
4-
while [ ! -d /sdcard/Download ]; do sleep 10; done
54
/data/adb/modules/zram-swap-manager/zram-swap-manager.sh -dr > $log 2>&1
5+
exit 0

zip.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ done
1111
cp -u install.sh customize.sh 2>/dev/null
1212
cp -u install.sh META-INF/com/google/android/update-binary 2>/dev/null
1313

14-
filename=zsm-$(date +%Y.%m.%d.%H.%M.%S).zip
14+
filename=zsm_magisk_$(date +%Y-%m-%d_%H:%M:%S).zip
1515
echo $filename
1616
zip -r9 $filename * .git* -x \*.zip -x .git/\* -x '_*/*'

zram-swap-manager.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
config_ver=202110290
1+
config_ver=202112020
22

33
comp_algorithm=auto
44
comp_ratio=210
@@ -13,7 +13,7 @@ medium_load_swappiness=90
1313
low_load_threshold=0
1414
low_load_swappiness=100
1515

16-
vm="swappiness=80 vfs_cache_pressure=200 page-cluster=0"
16+
vm="swappiness=80 page-cluster=0"
1717

1818
# android's low memory killer (deprecated in favor of lmkd in recent OS versions)
1919
# write /sys/module/lowmemorykiller/parameters/minfree "CUSTOM PARAMETERS GO HERE"

zram-swap-manager.sh

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env sh
22

3-
version="v2021.11.23 (202111230)"
3+
version="v2021.12.2 (202112020)"
44
info="zRAM Swap Manager $version
5+
Upstream repo: github.com/vr-25/zram-swap-manager
56
Copyright (C) 2021, VR25
67
License: GPLv3+"
78

@@ -53,31 +54,39 @@ mem_estimates() {
5354
prep_exec() {
5455
[ -d /data/adb ] && {
5556
mkswap() {
56-
for exec in /data/adb/vr25/bin/mkswap /system/*bin/mkswap /sbin/mkswap "busybox mkswap"; do
57-
if [ -x ${exec%% *} ] || which ${exec%% *} >/dev/null; then
58-
eval $exec "$@" && break || echo "(i) Trying alternative..."
57+
for exec in /data/adb/vr25/bin/mkswap /*/*bin/mkswap /sbin/mkswap mkswap; do
58+
if [ -x $exec ] || which $exec >/dev/null; then
59+
eval $exec "$@" && break || echo "(i) Trying alternative: $exec..."
5960
fi
6061
done
6162
}
6263
swapoff() {
63-
for exec in /data/adb/vr25/bin/swapoff /system/*bin/swapoff /sbin/swapoff "busybox swapoff"; do
64-
if [ -x ${exec%% *} ] || which ${exec%% *} >/dev/null; then
65-
eval $exec "$@" && break || echo "(i) Trying alternative..."
64+
for exec in /data/adb/vr25/bin/swapoff /*/*bin/swapoff /sbin/swapoff swapoff; do
65+
if [ -x $exec ] || which $exec >/dev/null; then
66+
eval $exec "$@" && break || echo "(i) Trying alternative: $exec..."
6667
fi
6768
done
6869
}
6970
swapon() {
70-
for exec in /data/adb/vr25/bin/swapon /system/*bin/swapon /sbin/swapon "busybox swapon"; do
71-
if [ -x ${exec%% *} ] || which ${exec%% *} >/dev/null; then
72-
eval $exec "$@" && break || echo "(i) Trying alternative..."
71+
for exec in /data/adb/vr25/bin/swapon /*/*bin/swapon /sbin/swapon swapon; do
72+
if [ -x $exec ] || which $exec >/dev/null; then
73+
eval $exec "$@" && break || echo "(i) Trying alternative: $exec..."
7374
fi
7475
done
7576
}
77+
# delay initialization to override android defaults and third party tweaks
78+
[ -d /sdcard/Android ] || {
79+
(while [ ! -d /sdcard/Android ]; do
80+
sleep 10
81+
set +x
82+
done)
83+
sleep 90
84+
}
7685
}
7786
}
7887

7988
stop_swappinessd() {
80-
rm $temp_dir/*.lock 2>/dev/null
89+
rm $temp_dir/*.lock 2>/dev/null && sleep 2
8190
}
8291

8392
swap_off() {
@@ -123,7 +132,7 @@ swappinessd() {
123132
lock_file=$temp_dir/$(date +%s).lock
124133
touch $lock_file
125134
(set +x
126-
exec <>/dev/null 2>&1
135+
exec </dev/null >/dev/null 2>&1
127136
while [ -f $lock_file ]; do
128137
load_avg1=$(calc "$(awk '{print $1}' /proc/loadavg) * 100 / $max_comp_streams")
129138
if [ $load_avg1 -ge $high_load_threshold ]; then

0 commit comments

Comments
 (0)