#!/bin/sh
#220121 sfs
f='aufs|overlay|ext[1-9]|fat|ntfs|zram|zswap|bbr|bfq|bmq|ksm|damon'
	p="$1"
	ur="*"
#	ls "$p"/usr/lib/modules/$ur/modules.builtin 
#uname -a
cat /proc/cmdline
#BIN(){
echo "-----------------------------"
echo --BuildIN :
egrep ${f} "$p"/usr/lib/modules/$ur/modules.builtin |sort
#egrep 'aufs|overlay|ext[1-9]|fat|ntfs|zram|zswap|bbr|bfq|bmq|ksmbd' /usr/lib/modules/`uname -r`/modules.builtin 
echo "-- .ko :"
#ls -1 /usr/lib/modules/`uname -r`/kernel/fs/ |egrep 'aufs|overlay|ext|fat|ntfs' 
egrep $f "$p"//usr/lib/modules/$ur/modules.order |sort
#}
    if [ "$1" ] ;then
	exit
    else ur="`uname -r`"
    fi

echo "-----------------------------"
if [ -f /proc/self/ksm ] || [ -f /sys/kernel/pmadv/ksm ] ;then
    echo "UKSM 5 detected"
    which uksmd  
elif [ -d /sys/kernel/mm/uksm ] ;then
    echo "Old UKSM detected"
    which uksmd  
else  echo "No UKSM in kernel" 
fi
echo "-----------------------------"
echo HDD SSD
#https://forum.puppyrus.org/index.php?topic=20554.msg178173#msg178173
#cat /sys/block/sda/queue/scheduler
grep "" /sys/block/*/queue/scheduler |egrep -v "/sys/block/loop|/sys/block/ram"
#To change the active I/O scheduler to bfq for device sda, use:
# echo bfq > /sys/block/sda/queue/scheduler
echo "-----------------------------"
# https://wiki.archlinux.org/title/Sysctl#Enable_BBR
# https://ru.wikipedia.org/wiki/CUBIC_TCP
# https://habr.com/ru/post/322430/
echo "TCP (BBR) : `sysctl net.ipv4.tcp_congestion_control` ; `sysctl net.core.default_qdisc`"
#sudo modprobe tcp_bbr2 && sudo sysctl -w net.ipv4.tcp_congestion_control=bbr2
# https://www.speedtest.net/
#bbr	2	93.97	93.97
#bbr2	3	94.74	94.11
#cubic	3	92.44	94.31
echo "-----------------------------"
echo "DAMON: `cat /sys/module/damon_reclaim/parameters/enabled `"
#echo "ZRAM: `cat /sys/block/zram0/comp_algorithm`"
echo "-----------------------------"
sysctl  vm.swappiness
swapon
zramctl
grep -R . /sys/module/zswap/parameters