Swap never used @Rockpi 4

I want to compile Kodi, but after 1h the System crashed.
I recognized, when the "free memory" goes below 350MB the System crashed.
To recognized (i dont want to wait always more than 1h) i have two terminal opened.

in one terminal i make:

stress --cpu 6 --io 4 --vm 2 --hdd 4

in the second terminal i make

while true; do free -m; sleep 2s; done

when the "Free Memory" goes below 350MB the System crashed

So i created a Swap, but it will never used. I played around to force the swap with vm.swappines between 10-100

sudo sysctl vm.swappines=80

but SWAP "used" is always 0

i created swap with:

sudo fallocate -l 1G /swapfile
sudo mkswap /swapfile
sudo chmo u=rw,go= /swapfile
sudo swapon /swapfile
sudo bash -c "echo /swapfile swap swap defaults 0 0 >> /etc/fstab"

OUTPUTS:


swapon
NAME      TYPE  SIZE USED PRIO
/swapfile file 1024M   0B   -2

free -m
              gesamt       benutzt     frei      gemns.  Puffer/Cache verfügbar
Speicher:        3861        1182        1818         158         860        2482
Swap:          1023           0        1023
sysctl vm.swappiness
vm.swappiness = 82
sysctl vm.overcommit_ratio
vm.overcommit_ratio = 50
sysctl vm.vfs_cache_pressure
vm.vfs_cache_pressure = 100
ps -e | grep swap
    355 ?        00:00:00 kswapd0
System:
  Host: pix Kernel: 5.4.0-1-MANJARO-ARM aarch64 bits: 64 compiler: gcc v: 9.1.0 
  Desktop: KDE Plasma 5.17.3 tk: Qt 5.13.2 wm: kwin_x11 dm: SDDM 
  Distro: Manjaro ARM 
Machine:
  Type: ARM Device System: Radxa ROCK Pi 4 details: N/A serial: <filter> 
CPU:
  Topology: 6-Core (2-Die) model: N/A variant-1: cortex-a53 
  variant-2: cortex-a72 bits: 64 type: MCP MCM arch: ARMv8 rev: 4 
  features: Use -f option to see features bogomips: 0 
  Speed: 600 MHz min/max: 408/1416:1800 MHz Core speeds (MHz): 1: 600 2: 600 
  3: 600 4: 600 5: 408 6: 408 
Graphics:
  Device-1: display-subsystem driver: rockchip_drm v: N/A bus ID: N/A 
  chip ID: rockchip:display-subsystem 
  Device-2: rk3399-dw-hdmi driver: dwhdmi_rockchip v: N/A bus ID: N/A 
  chip ID: rockchip:ff940000 
  Device-3: rk3399-mali driver: panfrost v: kernel bus ID: N/A 
  chip ID: rockchip:ff9a0000 
  Display: x11 server: X.org 1.20.6 driver: fbturbo compositor: kwin_x11 
  resolution: <xdpyinfo missing> 
  Message: Unable to show advanced data. Required tool glxinfo missing. 
Drives:
  Local Storage: total: 14.84 GiB used: 6.07 GiB (40.9%) 
  ID-1: /dev/mmcblk1 model: SC16G size: 14.84 GiB serial: <filter> scheme: MBR 
Partition:
  ID-1: / size: 14.13 GiB used: 6.07 GiB (42.9%) fs: ext4 dev: /dev/mmcblk1p1 
Sensors:
  Message: No sensors data was found. Is sensors configured? 
Info:
  Processes: 184 Uptime: 17m Memory: 3.77 GiB used: 1.09 GiB (28.9%) 
  Init: systemd v: 243 Compilers: gcc: N/A Shell: bash v: 5.0.11 
  running in: konsole inxi: 3.0.37 

on other OS (armbian / ubuntu bionic) i have no problem with Swap / compile / getting out of memory / freeze / crashed

Thanks for help
B0F1B0

""
there we have the salad
""

Looks like you may have left out a step in the swapfile creation and you seem to want a 4G swap but looks like you wound up with 1G. Here is how I do it:

sudo fallocate -l 4000M /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=4000
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile    # Makes Effective temporarily
 
# Add this line to /etc/fstab at the bottom to make permanent
 
sudo nano /etc/fstab
 
/swapfile none swap defaults 0 0

The default swapiness should be ok but for your testing to force it to start using it faster you can set the swapiness to 90.

If you want the system to use more ram before going to swap set the swapiness to 10. The values can be a little confusing. Say a value of 10 means the system will use 90% of the system ram before it starts using the swap space.

# Swapiness:
 
sudo sysctl vm.swappiness=90   # Makes Effective temporarily
 
# Make permanent
 
# sudo nano /etc/sysctl.d/99-sysctl.conf and add this
 
vm.swappiness=90

Thanks for your reply,

the problem is not the creation of swap - yes i mixed the posted code, i show the creation of 4GB swap and a usage of 1GB.....i corrected my post.....

the problem is: THE SWAP is NEVER USED!

I looked at the kernel and it certainly is enabled.

i created the SWAP like you wrote. i opened 50 Tabs in Firefox to fill the RAM --> CRASH

I am beginning to think you may have a similar issue like I am having here with the rockpro64. Strit is convinced it is an I/O problem.

If you go by what is said here:

https://www.linuxatemyram.com/

Particularly this section you have plenty of free ram (1.8G) so it will not go into swap.

If this is true the I am leaning to the kernel as being the issue. My rockpro64 is also using this kernel. I also noticed the present kernel was updated 4 days ago.

1 Like

yes, i have similar issue like the rockpro64, because both are RK3399.
I know that there are differents between "free" and "available" RAM... thats why i tried to force with vm.swappiness=100 to use the SWAP. but the swap is not uses. And yes, maybe its not a "swap" problem even an I/O problem. But in both cases i cannot use manajro.
I also tried with playing of the I/O Sheduler
I/O Scheduler : NOOP , Deadline and CFQ .

but it also crashed.

I am facing issue with similar symptoms on a Rock Pi 4 v1.3, with Manjaro ARM Xfce 19.12.

If I do an operation with large IO (for eg, I tried moving Manjaro root from SD card to external SSD), the kernel crashed:

[ 1056.633446] SError Interrupt on CPU1, code 0xbf000000 -- SError
[ 1056.633451] CPU: 1 PID: 2262 Comm: JS Helper Tainted: G         C        5.4.0-1.5-MANJARO-ARM #1
[ 1056.633452] Hardware name: Radxa ROCK Pi 4 (DT)
[ 1056.633454] pstate: 20000000 (nzCv daif -PAN -UAO)
[ 1056.633455] pc : 0000ffff9f71c890
[ 1056.633457] lr : 0000ffff9f71c7c8
[ 1056.633458] sp : 0000ffff95efe550
[ 1056.633460] x29: 0000ffff9298e190 x28: 0000000000000020 
[ 1056.633464] x27: 0000000000000001 x26: 0000000000000036 
[ 1056.633467] x25: 7fffffff7fc00000 x24: 0000000000000016 
[ 1056.633470] x23: 0000000000000000 x22: 0000ffffa08b5000 
[ 1056.633473] x21: 0000000000000048 x20: 0000ffff92999080 
[ 1056.633476] x19: 0000ffff8ff4ba60 x18: 0000000000000041 
[ 1056.633479] x17: 0000000000000002 x16: 0000000000000000 
[ 1056.633482] x15: 0000ffff9298e8c8 x14: 0000000000000013 
[ 1056.633485] x13: 0000000000000000 x12: 00000000000000b3 
[ 1056.633488] x11: 0000ffff929ad000 x10: 0000000000000000 
[ 1056.633491] x9 : 0000ffffa4d5b660 x8 : 5c2d141f05b66d00 
[ 1056.633494] x7 : 0000000000000001 x6 : 0000000000000000 
[ 1056.633497] x5 : 000000000000017f x4 : 0000ffff95efe648 
[ 1056.633500] x3 : 00000000000000a8 x2 : 0000000000013f38 
[ 1056.633503] x1 : 0000000000004000 x0 : 0000ffff8ff4ba60 
[ 1056.633507] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 1056.633530] SMP: stopping secondary CPUs
[ 1056.633531] Kernel Offset: disabled
[ 1056.633532] CPU features: 0x0002,2000600c
[ 1056.633534] Memory Limit: none

Searching online, found this thread:
https://www.spinics.net/lists/arm-kernel/msg748672.html

Looks like it can be caused by a particular combination of u-boot + boot environment:
https://lore.kernel.org/linux-arm-kernel/006d3ee0-2711-1b4e-d8cf-6a226fcad0e4@arm.com/

Its quite easy to reproduce.

When I start the transfer, the system cache in RAM starts filling up (monitored using htop). As it reaches the limit, the kernel crashes.

To workaround this bug for my specific case, I used the following command repeatedly while the transfer was in progress:

echo 3 > /proc/sys/vm/drop_caches

Found here:

My Solution:

i play around with some sysctl vm.SETTINGS

i found out that when i change

$ sudo sysctl vm.min_free_kbytes
vm.min_free_kbytes = 7865

to

$ sudo sysctl vm.min_free_kbytes=500000

the System does not CRASH anymore.

It depends to u to find a more less value for this setting.

to make this setting permanent:

sudo nano /etc/sysctl.d/99-sysctl.conf

 and add this:
 
vm.min_free_kbytes=500000

@DEV Team / @Strit

it depends on u to make something with this solution.

B0F1B0

"the we have the salad"

2 Likes

Which DE are you using.

i use KDE-PLASMA

Forum kindly sponsored by