Messages in this thread | | | Date | Wed, 15 Aug 2012 21:46:10 -0500 | From | Daniel Forrest <> | Subject | Repeated fork() causes SLAB to grow without bound |
| |
I'm hoping someone has seen this before...
I've been trying to track down a performance problem with Linux 3.0.4. The symptom is system-mode load increasing over time while user-mode load remains constant while running a data ingest/processing program.
Looking at /proc/meminfo I noticed SUnreclaim increasing steadily.
Looking at /proc/slabinfo I noticed anon_vma and anon_vma_chain also increasing steadily.
I was able to generate a simple test program that will cause this:
---
#include <unistd.h>
int main(int argc, char *argv[]) { pid_t pid;
while (1) { pid = fork(); if (pid == -1) { /* error */ return 1; } if (pid) { /* parent */ sleep(2); break; } else { /* child */ sleep(1); } } return 0; }
---
In the actual program (running as a daemon), a child is reading data while its parent is processing the previously read data. At any time there are only a few processes in existence, with older processes exiting and new processes being fork()ed. Killing the program frees the slab usage.
I patched the kernel to 3.0.40, but the problem remains. I also compiled with slab debugging and can see that the growth of anon_vma and anon_vma_chain is due to anon_vma_clone/anon_vma_fork.
Is this a known issue? Is it fixed in a later release?
Thanks,
-- Daniel K. Forrest Space Science and dan.forrest@ssec.wisc.edu Engineering Center (608) 890 - 0558 University of Wisconsin, Madison
| |