Archive for 1 mayo 2018


Kswapd0 probem at Raspberry Pi 3 with Raspbian


If in a Raspberry Pi there is a problem of resources, going slow or even frozen, and a process named “Kswapd0” is taking a lot of CPU:

root@Shirley:~# ps uax | grep kswap
root 44 0.2 0.0 0 0 ? S 11:28 1:59 [kswapd0]

is due to any process that is consuming a lot of memory, causing the need of to do “swapping“. This is, saving RAM memory at the HD (SD card in Raspberry Pi), so the operating system (Raspbian i.e.) can allocate memory to other process.

The SD card is quite slow (about 20MB/seg), what makes hard and slow the swapping process, and this drivers the Raspberry to require minutes or hours if a process is demanding a lot of RAM memory. The main advice to avoid this problem is to assume that Raspberry PI is a machine with a lot of limitations, not designed for general purposes (Desktops, browsing the web, computing, etc).

For palliating problems, you can follow next tips:

1º) Updating the system to get the state of art kernell. If you have Raspbian, run as root:

root@Shirley:~# apt-get update
root@Shirley:~# apt-get upgrade
root@Shirley:~# apt-get dist-update
root@Shirley:~# reboot

2º) Change the microSD card for another more modern and better, like the Samsung Evo+ 32GB microSD card. A SD card class 10 is enough for Raspberry Pi 3, as the machine cannot write faster than the Samsung card supports. Anyway, you can investigate reviews and comparisons of new microSD cards for Raspberry at Internet.

3º) Booting from a USB SSD disk may help, but it is expensive and the improvement is not guaranteed, as the USB 2.0 port has a maximum speed of about 20MB/s.

4º) Check the process that demands so many RAM memory. Try to update it, tune it, check for any bug (memory leak), report the high RAM consumption to developers, or by last, look for an alternative.

5º) Update Raspberry´s firmware:

root@Shirley:~# rpi-update