Linux – What does pdflush attempt to do when a CentOS server runs out of memory and does not have a swap partition

centoslinuxmemory

I noticed one of our CentOS machines was very close to 100% memory usage last night. The load average on the machine shot up to ~16 and I noticed that there were several pdflush processes that were blocked on Disk IO (run state D in top). I thought pdflush was used to swap data from memory to disk (os memory paging), but that particular server didn't have a swap partition mounted. So what was pdflush actually doing in this case?

Best Answer

pdflush's primary duty is flushing the disk buffer cache (AFAIk this is its only duty, but a Linux guru may correct me on this). The cache it flushes includes files that have been written to but not yet committed to disk.
If I recall correctly kswapd is the virtual process responsible for dealing with swap space & shuffling memory pages from RAM to disk & back again.


For the health of your system, please set up a swap partition for your server (or swapon the one you have)

Unix-like systems expect to be able to swap. Bad Things can happen when there is no available swap (like the disk buffer cache getting squeezed down to a tiny bit of memory, which can really make pdflush have a bad day).
Even if you'll "never" use the swap space, disk is cheap enough that you can throw 2G at it.

Related Topic