Avoiding page allocation failures on the Pi

Since I’ve been using my 256MB Model B Pi as a server, I had been getting regular page allocation failures of the following kind:

sshd: page allocation failure: order:0, mode:0x20

This is rather annoying and seems to affect stability as well, like disrupted ssh or smb connections. It seems that the kernel has a setting to affect the minimum free memory that it keeps for allocations, which may be too low. So in the /etc/sysctl.conf file you can edit the last lines to bump this value from 8 Mbegabytes to 16 Megabytes:

# rpi tweaks
vm.min_free_kbytes = 16184

Settings are effective after a reboot. For me, this seems to fix the problem. But to be extra sure, I also changed the memory split from 192/64 to 224/32. Since my Pi runs headless, 64 MBytes seemed too much simply for a framebuffer console that is not even used. So after these tweaks my Pi shows 216 MByte of available memory and is running for some days now without page allocation errors.

Leave a Reply

Your email address will not be published.