Subject: Re: kernel limits (??)
To: None <>
From: John Darrow <>
List: tech-kern
Date: 10/14/1998 13:38:30
In article <> you write:
<We're having a bit of a problem with a program we have written.  I
<think we may be running up against some sort of kernel limit.  And,
<I was hoping that maybe a change to a constant might be all that is
<Here is the situation...  We have a program that is generating
<network traffic.  It splits off into lots of processes, each
<handling one TCP flow.  After the connection is terminated the
<process goes away.  We can push this until we hit ~230 processes and
<then the machine panics in vm_map_entry_create.  We have plenty of
<virtual memory on these machines (~1 GB of VM; each process is ~300
<KB).  And, looking at the output of "top" right before the crash, it
<doesn't look like we're actually pushing against the VM limit at
<all.  The last time we ran this test, for instance, the last top
<output reported 258 processes and 256 sleeping.  
<The "256" stuck out as a sort of magic sounding number.  We bumped
<up the number of processes (increased MAXUSERS, which increased
<NPROC), so that we have something like a 1000 process limit.  We're
<sort of at a loss as to what else we can do.  If anyone has any
<ideas about what to do, we would be very interested to hear them.
<(Oh, and I am not on this mailing list, so if you reply to the list,
<please CC me.  Thanks!).

I recently ran into the same problem on a news server running 1.3.2.
Raising NMBCLUSTERS or NKMEMCLUSTERS didn't help.  I eventually tracked
it down to running out of static KMAP entries.

In 1.3.2, sys/vm/vm_map.h contains the following:

/* XXX: number of kernel maps and entries to statically allocate */
#define MAX_KMAP	10
#define MAX_KMAPENT	500

current has a higher limit:

/* XXX: number of kernel maps and entries to statically allocate */
#define MAX_KMAP	10
#if 0
#define MAX_KMAPENT	500
#define MAX_KMAPENT	1000  /* XXXCDC: no crash */

apparently someone else ran into this crash before :)

Try the included patch.  It will let you raise the MAX_KMAP and MAX_KMAPENT
values in your config file, using 'options MAX_KMAP' and 'options MAX_KMAPENT'
(like the current 'options NMBCLUSTERS' and 'options NKMEMCLUSTERS' lines).
I'll probably go ahead and send-pr this as a change-request to make these
values configurable...


John Darrow
Computing Services, Wheaton College, Wheaton, IL

$ diff -c vm_map.h_v1.14 vm_map.h
*** vm_map.h_v1.14	Tue May  5 01:54:19 1998
--- vm_map.h	Thu Oct  1 10:11:02 1998
*** 208,215 ****
--- 208,219 ----
  #define		vm_map_pmap(map)	((map)->pmap)
  /* XXX: number of kernel maps and entries to statically allocate */
+ #ifndef MAX_KMAP
  #define MAX_KMAP	10
+ #endif
+ #ifndef MAX_KMAPENT
  #define	MAX_KMAPENT	500
+ #endif
  #ifdef _KERNEL
  boolean_t	 vm_map_check_protection __P((vm_map_t,