* Fork() issue
@ 2006-02-22 20:38 Hai Wang
0 siblings, 0 replies; only message in thread
From: Hai Wang @ 2006-02-22 20:38 UTC (permalink / raw)
To: linux-kernel
Hello everyone,
I encountered a problem with linux kernel, please help if you can.
I am writing an application which is listening to multiple sockets.
Scenario I:
Say, the application is listening to 6000 sockets, while a socket receives any packet, the application will close the socket and fork a child process to reopen the socket and do the packets processes and so on. But for some reasons, the application could not fork more than 1000 child processes due to fork function failure as indicated in the following kernel code
do_fork()->......copy_files()-> ... expand_fd_array()->...alloc_fd_array()à vmalloc ()->get_vm_area(){
........
if (addr > VMALLOC_END-size) {
goto out;
}
}
It seems to me that VMALLOC_END is out of boundary, but system still has plenty of memory left and CONFIG_HIGHMEM4G enabled
If I disabled CONFIG_HIGHMEM4G, then the application can fork more than 1000 child processes until memory exhausted.
While CONFIG_HIGHMEM4G is enabled, we reduced # of sockets to be listened, then # of child processes which can be forked will be increased, but fork still failed at the same located above before the memory exhausted.
My system settings:
1. 2G memory
2. Redhat9 with kernel 2.4.25
3. file_max = 102400
4. ulimit -n
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 102398
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 6143
virtual memory (kbytes, -v) unlimited
5. define __FD_SETSIZE 102400
It seems to me that fork might take the wrong VMALLOC_END when CONFIG_HIGHMEM4G is enabled, I have no clue on where I should look into, and any help is much appreciated.
Thanks!
Hai Wang
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-02-22 20:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-22 20:38 Fork() issue Hai Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).