3

I am using Ubuntu 12.04 and XFS (kernel 3.2.0-38-generic). Because XFS inode cache use too much memory, I want to limit the number of objects used to cache XFS inode.

According to the manual, I can limit the number by writing limit to /proc/slabinfo. But I cannot write to /proc/slabinfo even with superuser privileges.

$ echo "xfs_inode 1024 0 0" | sudo tee /proc/slabinfo
xfs_inode 1024 0 0
tee: /proc/slabinfo: Input/output error

What is the problem? Are there any way to limit the number of object in slab cache?

beketa
  • 93
  • 1
  • 1
  • 6

1 Answers1

1

The slabinfo(5) page is unfortunately quite out of date. If I understand correctly, in a kernel that is configured to use the SLUB allocator (available since Linux 2.6.22, and nowadays the default kernel memory allocator), the /proc/slabinfo file is not writable. See the contrasting definitions of slabinfo_write() in the kernel source files mm/slub.c and mm/slab.c. In mm/slub.c, slabinfo_write() simply fails with the error EIO.

Edit: Just confirmed my understanding by compiling a kernel to use the SLAB allocator rather than the default SLUB allocator. In this case, the /proc/slabinfo is writable in the manner posed in the original question. With CONFIG_SLUB, the file is not writable, and the tunables display as 0.

mtk
  • 191
  • 1
  • 4