Subject: Making (old) VM MAP_KMAPENT autosize from maxusers
To: None <tech-kern@netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 10/22/1998 18:27:38
The following patch makes MAP_KMAPENT with the (old) VM system
autosize enough space for maxusers's worth of processes.

That means making NPROC visible to vm_map.h, but short of
defparam'ing NPROC, i dont see a way around that.

Anyone object to this? Given the pain its caused 1.3.2 users,
I'd like to commit it and request a pullup for the 1.3.3 release.




Index: sys/sys/param.h
===================================================================
RCS file: /cvsroot/src/sys/sys/param.h,v
retrieving revision 1.52
diff -c -r1.52 param.h
*** param.h	1998/09/01 05:20:39	1.52
--- param.h	1998/10/23 01:26:18
***************
*** 117,123 ****
--- 117,132 ----
  #include <sys/resource.h>
  #include <sys/ucred.h>
  #include <sys/uio.h>
+ #ifndef NPROC
+ #define	NPROC (20 + 16 * MAXUSERS)
  #endif
+ #ifndef NTEXT
+ #define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
+ #endif
+ #ifndef NVNODE
+ #define	NVNODE (NPROC + NTEXT + 100)
+ #endif
+ #endif /* _KERNEL */
  
  /* Signals. */
  #include <sys/signal.h>
Index: sys/conf/param.c
===================================================================
RCS file: /cvsroot/src/sys/conf/param.c,v
retrieving revision 1.24
diff -c -r1.24 param.c
*** param.c	1998/10/19 22:16:22	1.24
--- param.c	1998/10/23 01:26:18
***************
*** 94,109 ****
  int	tick = 1000000 / HZ;
  int	tickadj = 240000 / (60 * HZ);		/* can adjust 240ms in 60s */
  int	rtc_offset = RTC_OFFSET;
- #ifndef NPROC
- #define	NPROC (20 + 16 * MAXUSERS)
- #endif
  int	maxproc = NPROC;
- #ifndef NTEXT
- #define	NTEXT (80 + NPROC / 8)			/* actually the object cache */
- #endif
- #ifndef NVNODE
- #define	NVNODE (NPROC + NTEXT + 100)
- #endif
  int	desiredvnodes = NVNODE;
  int	maxfiles = 3 * (NPROC + MAXUSERS) + 80;
  int	ncallout = 16 + NPROC;
--- 94,100 ----
Index: sys/vm/vm_map.h
===================================================================
RCS file: /cvsroot/src/sys/vm/vm_map.h,v
retrieving revision 1.20
diff -c -r1.20 vm_map.h
*** vm_map.h	1998/10/11 22:56:42	1.20
--- vm_map.h	1998/10/23 01:26:19
***************
*** 257,267 ****
  
  /* XXX: number of kernel maps and entries to statically allocate */
  #define MAX_KMAP	10
! #if 0
! #define	MAX_KMAPENT	500
  #else
  #define	MAX_KMAPENT	1000  /* XXXCDC: no crash */
  #endif
  
  #ifdef _KERNEL
  boolean_t	 vm_map_check_protection __P((vm_map_t,
--- 257,271 ----
  
  /* XXX: number of kernel maps and entries to statically allocate */
  #define MAX_KMAP	10
! 
! #if !defined(MAX_KMAPENT)
! #if (50 + (2 * NPROC) > 1000)
! #define MAX_KMAPENT (50 + (2 * NPROC))
  #else
  #define	MAX_KMAPENT	1000  /* XXXCDC: no crash */
  #endif
+ #endif	/* !defined MAX_KMAPENT */
+ 
  
  #ifdef _KERNEL
  boolean_t	 vm_map_check_protection __P((vm_map_t,