9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] kernel: make conf.nproc configurable. all kernels now default to 100 + ((conf.npage*BY2PG)/MB)*5
@ 2021-06-07  9:01 james palmer
  2021-06-14  1:55 ` ori
  0 siblings, 1 reply; 3+ messages in thread
From: james palmer @ 2021-06-07  9:01 UTC (permalink / raw)
  To: 9front

---
diff 9eb2b302e6240695960f5ce37c68e40a96da44d6 56656a7ac6aac082b65d77cf0a0e4bc492ddcd2c
--- a/sys/src/9/bcm/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/bcm/main.c	Mon Jun  7 10:01:32 2021
@@ -219,11 +219,12 @@
 	conf.nmach = getncpus();
 
 	/* set up other configuration parameters */
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtoul(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+	
 	conf.nswap = conf.npage*3;
 	conf.nswppo = 4096;
 	conf.nimage = 200;
--- a/sys/src/9/bcm64/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/bcm64/main.c	Mon Jun  7 10:01:32 2021
@@ -90,11 +90,12 @@
 	conf.nmach = getncpus();
 
 	/* set up other configuration parameters */
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtoul(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nswap = conf.npage*3;
 	conf.nswppo = 4096;
 	conf.nimage = 200;
--- a/sys/src/9/cycv/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/cycv/main.c	Mon Jun  7 10:01:32 2021
@@ -100,13 +100,19 @@
 {
 	ulong kmem;
 	int i;
+	char *p;
 
 	conf.nmach = 1;
-	conf.nproc = 2000;
 	conf.ialloc = 16*1024*1024;
 	conf.nimage = 200;
 	conf.mem[0].base = PGROUND((ulong)end - KZERO);
 	conf.mem[0].npage = (1024*1024*1024 - conf.mem[0].base) >> PGSHIFT;
+	
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtoul(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
 
 	ramdiskinit();
 
--- a/sys/src/9/kw/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/kw/main.c	Mon Jun  7 10:01:32 2021
@@ -397,6 +397,7 @@
 	int i;
 	ulong kpages;
 	uintptr pa;
+	char *p;
 
 	/*
 	 * Copy the physical memory configuration to Conf.mem.
@@ -430,11 +431,12 @@
 	conf.nmach = 1;
 
 	/* set up other configuration parameters */
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtoul(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nswap = conf.npage*3;
 	conf.nswppo = 4096;
 	conf.nimage = 200;
--- a/sys/src/9/mtx/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/mtx/main.c	Mon Jun  7 10:01:32 2021
@@ -180,11 +180,13 @@
 	conf.npage = conf.mem[0].npage;
 
 	conf.nmach = 1;
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nimage = 200;
 	conf.nswap = conf.nproc*80;
 	conf.nswppo = 4096;
--- a/sys/src/9/omap/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/omap/main.c	Mon Jun  7 10:01:32 2021
@@ -449,15 +449,15 @@
 	conf.nmach = 1;
 
 	/* set up other configuration parameters */
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nswap = conf.npage*3;
 	conf.nswppo = 4096;
 	conf.nimage = 200;
-
 	conf.copymode = 0;		/* copy on write */
 
 	/*
--- a/sys/src/9/pc/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/pc/main.c	Mon Jun  7 10:01:32 2021
@@ -155,11 +155,12 @@
 	for(i=0; i<nelem(conf.mem); i++)
 		conf.npage += conf.mem[i].npage;
 
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+		
 	conf.nimage = 200;
 	conf.nswap = conf.nproc*80;
 	conf.nswppo = 4096;
--- a/sys/src/9/pc64/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/pc64/main.c	Mon Jun  7 10:01:32 2021
@@ -39,12 +39,13 @@
 	conf.npage = 0;
 	for(i=0; i<nelem(conf.mem); i++)
 		conf.npage += conf.mem[i].npage;
+	
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
 
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
 	conf.nimage = 200;
 	conf.nswap = conf.nproc*80;
 	conf.nswppo = 4096;
--- a/sys/src/9/ppc/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/ppc/main.c	Mon Jun  7 10:01:32 2021
@@ -243,11 +243,13 @@
 	conf.npage = conf.mem[0].npage + conf.mem[1].npage;
 
 	conf.nmach = 1;
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nimage = 200;
 	conf.nswap = conf.nproc*80;
 	conf.nswppo = 4096;
--- a/sys/src/9/sgi/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/sgi/main.c	Mon Jun  7 10:01:32 2021
@@ -334,6 +334,7 @@
 confinit(void)
 {
 	ulong kpages;
+	char *p;
 
 	/*
 	 *  set up CPU's mach structure
@@ -345,7 +346,12 @@
 	conf.nmach = 1;
 
 	/* set up other configuration parameters */
-	conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nswap = 262144;
 	conf.nswppo = 4096;
 	conf.nimage = 200;
--- a/sys/src/9/teg2/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/teg2/main.c	Mon Jun  7 10:01:32 2021
@@ -647,11 +647,12 @@
 	conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
 
 	/* set up other configuration parameters */
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nswap = conf.npage*3;
 	conf.nswppo = 4096;
 	conf.nimage = 200;
--- a/sys/src/9/xen/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/xen/main.c	Mon Jun  7 10:01:32 2021
@@ -249,11 +249,12 @@
 	for(i=0; i<nelem(conf.mem); i++)
 		conf.npage += conf.mem[i].npage;
 
-	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
-	if(cpuserver)
-		conf.nproc *= 3;
-	if(conf.nproc > 2000)
-		conf.nproc = 2000;
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtol(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.nimage = 200;
 	conf.nswap = conf.nproc*80;
 	conf.nswppo = 4096;
--- a/sys/src/9/zynq/main.c	Mon Jun  7 09:39:21 2021
+++ b/sys/src/9/zynq/main.c	Mon Jun  7 10:01:32 2021
@@ -170,9 +170,16 @@
 {
 	ulong kmem;
 	int i;
+	char *p;
 
 	conf.nmach = 1;
-	conf.nproc = 2000;
+
+	conf.nproc = 0;
+	if(p = getconf("*nproc"))
+		conf.nproc = strtoul(p, 0, 0);
+	if(conf.nproc == 0)
+		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
+
 	conf.ialloc = 16*1024*1024;
 	conf.nimage = 200;
 	conf.mem[0].base = PGROUND((ulong)end - KZERO);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] [PATCH] kernel: make conf.nproc configurable. all kernels now default to 100 + ((conf.npage*BY2PG)/MB)*5
  2021-06-07  9:01 [9front] [PATCH] kernel: make conf.nproc configurable. all kernels now default to 100 + ((conf.npage*BY2PG)/MB)*5 james palmer
@ 2021-06-14  1:55 ` ori
  2021-06-14 17:18   ` cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: ori @ 2021-06-14  1:55 UTC (permalink / raw)
  To: 9front

idea makes sense, but while you're
in here, it's probably a good idea
to move the code to port/.

Quoth james palmer <james@biobuf.link>:
> ---
> diff 9eb2b302e6240695960f5ce37c68e40a96da44d6 56656a7ac6aac082b65d77cf0a0e4bc492ddcd2c
> --- a/sys/src/9/bcm/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/bcm/main.c	Mon Jun  7 10:01:32 2021
> @@ -219,11 +219,12 @@
>  	conf.nmach = getncpus();
>  
>  	/* set up other configuration parameters */
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtoul(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +	
>  	conf.nswap = conf.npage*3;
>  	conf.nswppo = 4096;
>  	conf.nimage = 200;
> --- a/sys/src/9/bcm64/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/bcm64/main.c	Mon Jun  7 10:01:32 2021
> @@ -90,11 +90,12 @@
>  	conf.nmach = getncpus();
>  
>  	/* set up other configuration parameters */
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtoul(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nswap = conf.npage*3;
>  	conf.nswppo = 4096;
>  	conf.nimage = 200;
> --- a/sys/src/9/cycv/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/cycv/main.c	Mon Jun  7 10:01:32 2021
> @@ -100,13 +100,19 @@
>  {
>  	ulong kmem;
>  	int i;
> +	char *p;
>  
>  	conf.nmach = 1;
> -	conf.nproc = 2000;
>  	conf.ialloc = 16*1024*1024;
>  	conf.nimage = 200;
>  	conf.mem[0].base = PGROUND((ulong)end - KZERO);
>  	conf.mem[0].npage = (1024*1024*1024 - conf.mem[0].base) >> PGSHIFT;
> +	
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtoul(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
>  
>  	ramdiskinit();
>  
> --- a/sys/src/9/kw/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/kw/main.c	Mon Jun  7 10:01:32 2021
> @@ -397,6 +397,7 @@
>  	int i;
>  	ulong kpages;
>  	uintptr pa;
> +	char *p;
>  
>  	/*
>  	 * Copy the physical memory configuration to Conf.mem.
> @@ -430,11 +431,12 @@
>  	conf.nmach = 1;
>  
>  	/* set up other configuration parameters */
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtoul(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nswap = conf.npage*3;
>  	conf.nswppo = 4096;
>  	conf.nimage = 200;
> --- a/sys/src/9/mtx/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/mtx/main.c	Mon Jun  7 10:01:32 2021
> @@ -180,11 +180,13 @@
>  	conf.npage = conf.mem[0].npage;
>  
>  	conf.nmach = 1;
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nimage = 200;
>  	conf.nswap = conf.nproc*80;
>  	conf.nswppo = 4096;
> --- a/sys/src/9/omap/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/omap/main.c	Mon Jun  7 10:01:32 2021
> @@ -449,15 +449,15 @@
>  	conf.nmach = 1;
>  
>  	/* set up other configuration parameters */
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nswap = conf.npage*3;
>  	conf.nswppo = 4096;
>  	conf.nimage = 200;
> -
>  	conf.copymode = 0;		/* copy on write */
>  
>  	/*
> --- a/sys/src/9/pc/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/pc/main.c	Mon Jun  7 10:01:32 2021
> @@ -155,11 +155,12 @@
>  	for(i=0; i<nelem(conf.mem); i++)
>  		conf.npage += conf.mem[i].npage;
>  
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +		
>  	conf.nimage = 200;
>  	conf.nswap = conf.nproc*80;
>  	conf.nswppo = 4096;
> --- a/sys/src/9/pc64/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/pc64/main.c	Mon Jun  7 10:01:32 2021
> @@ -39,12 +39,13 @@
>  	conf.npage = 0;
>  	for(i=0; i<nelem(conf.mem); i++)
>  		conf.npage += conf.mem[i].npage;
> +	
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
>  
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
>  	conf.nimage = 200;
>  	conf.nswap = conf.nproc*80;
>  	conf.nswppo = 4096;
> --- a/sys/src/9/ppc/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/ppc/main.c	Mon Jun  7 10:01:32 2021
> @@ -243,11 +243,13 @@
>  	conf.npage = conf.mem[0].npage + conf.mem[1].npage;
>  
>  	conf.nmach = 1;
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nimage = 200;
>  	conf.nswap = conf.nproc*80;
>  	conf.nswppo = 4096;
> --- a/sys/src/9/sgi/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/sgi/main.c	Mon Jun  7 10:01:32 2021
> @@ -334,6 +334,7 @@
>  confinit(void)
>  {
>  	ulong kpages;
> +	char *p;
>  
>  	/*
>  	 *  set up CPU's mach structure
> @@ -345,7 +346,12 @@
>  	conf.nmach = 1;
>  
>  	/* set up other configuration parameters */
> -	conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nswap = 262144;
>  	conf.nswppo = 4096;
>  	conf.nimage = 200;
> --- a/sys/src/9/teg2/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/teg2/main.c	Mon Jun  7 10:01:32 2021
> @@ -647,11 +647,12 @@
>  	conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
>  
>  	/* set up other configuration parameters */
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nswap = conf.npage*3;
>  	conf.nswppo = 4096;
>  	conf.nimage = 200;
> --- a/sys/src/9/xen/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/xen/main.c	Mon Jun  7 10:01:32 2021
> @@ -249,11 +249,12 @@
>  	for(i=0; i<nelem(conf.mem); i++)
>  		conf.npage += conf.mem[i].npage;
>  
> -	conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> -	if(cpuserver)
> -		conf.nproc *= 3;
> -	if(conf.nproc > 2000)
> -		conf.nproc = 2000;
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtol(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.nimage = 200;
>  	conf.nswap = conf.nproc*80;
>  	conf.nswppo = 4096;
> --- a/sys/src/9/zynq/main.c	Mon Jun  7 09:39:21 2021
> +++ b/sys/src/9/zynq/main.c	Mon Jun  7 10:01:32 2021
> @@ -170,9 +170,16 @@
>  {
>  	ulong kmem;
>  	int i;
> +	char *p;
>  
>  	conf.nmach = 1;
> -	conf.nproc = 2000;
> +
> +	conf.nproc = 0;
> +	if(p = getconf("*nproc"))
> +		conf.nproc = strtoul(p, 0, 0);
> +	if(conf.nproc == 0)
> +		conf.nproc = 100 + ((conf.npage*BY2PG)/MB)*5;
> +
>  	conf.ialloc = 16*1024*1024;
>  	conf.nimage = 200;
>  	conf.mem[0].base = PGROUND((ulong)end - KZERO);
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] [PATCH] kernel: make conf.nproc configurable. all kernels now default to 100 + ((conf.npage*BY2PG)/MB)*5
  2021-06-14  1:55 ` ori
@ 2021-06-14 17:18   ` cinap_lenrek
  0 siblings, 0 replies; 3+ messages in thread
From: cinap_lenrek @ 2021-06-14 17:18 UTC (permalink / raw)
  To: 9front

also just increasing nproc will have performance degradation in
some places. the kernel in some places will just iterate over
all process slots for some queries, like sending to a note
group or finding the processes that use a segment.

if that stucrure could be more dynamic we might not even need
to have such low nproc defaults. but it is here because keeping
it small keeps these operations fast.

there are also limiting factors like that we need to allocate
KSTACK bytes of memory for each process. and buffers when they
do i/o... which might be more limited by kernel KZERO address
window.



--
cinap

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-14 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07  9:01 [9front] [PATCH] kernel: make conf.nproc configurable. all kernels now default to 100 + ((conf.npage*BY2PG)/MB)*5 james palmer
2021-06-14  1:55 ` ori
2021-06-14 17:18   ` cinap_lenrek

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git