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"


/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
  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 
  Type: ARM Device System: Radxa ROCK Pi 4 details: N/A serial: <filter> 
  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 
  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. 
  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 
  ID-1: / size: 14.13 GiB used: 6.07 GiB (42.9%) fs: ext4 dev: /dev/mmcblk1p1 
  Message: No sensors data was found. Is sensors configured? 
  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

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

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:


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.

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.

Forum kindly sponsored by