Linux Error: Page Allocation Failure and Solution

Posted on in Categories , , , , , , , , last updated September 25, 2008

Q. How do I get rid of an error message that read as – “Page allocation failure“?

A. Memory management is done by Linux kernel. Virtual memory systems separate the memory addresses used by a process from actual physical addresses, allowing separation of processes and increasing the effectively available amount of RAM using disk swapping. The quality of the virtual memory manager can have a big impact on overall system performance. This error related to memory fragmentation i.e. a new job / process cannot be loaded into memory due to fragmentation issue. To get rid of this problem try all of the following:

  1. Upgrade kernel to latest version
  2. Set VM kernel variables using sysctl or /etc/sysctl.conf file. /proc/sys/vm used for the virtual memory subsystem. You need to setup following two variables:

    • vm.lower_zone_protection=N : If running the 32-bit hugemem kernel isn’t an option either, you can try setting /proc/sys/vm/lower_zone_protection to a value of 250 or more.
      This will cause the kernel to try to be more aggressive in defending the low zone from allocating memory that could potentially be allocated in the high memory zone. As far as I know, this option isn’t available until the 2.6.x kernel.
    • vm.vfs_cache_pressure=N : Controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects. At the default value of vfs_cache_pressure=100 the kernel will attempt to reclaim dentries and inodes at a “fair” rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100
      causes the kernel to prefer to reclaim dentries and inodes.
  3. For 32 bit systems with 4GiB or more RAM consider using the hugemem kernel, which has almost 4GB lowmem area.

Sample /etc/sysctl.conf for Kernel 2.6.x


1 comment

  1. You need to enclose the value for vm.lowmem_reserve_ratio in /etc/sysctl.conf with single quotes, like this:
    vm.lowmem_reserve_ratio = ‘256 256 9’

    You also need the quotes if you change it on-the-fly with
    # echo ‘256 256 9’ > /proc/sys/vm/lowmem_reserve_ratio

Leave a Comment