9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] [PATCH] kernel: make conf.nproc configurable. all kernels now default to 100 + ((conf.npage*BY2PG)/MB)*5
Date: Sun, 13 Jun 2021 21:55:25 -0400
Message-ID: <3B7CD4D57FAF1705F3A5E6363CAADE67@eigenstate.org> (raw)
In-Reply-To: <A42F231F7A0292D1DF88D1BCA49A8909@biobuf.link>

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);
> 


  reply	other threads:[~2021-06-14  2:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07  9:01 james palmer
2021-06-14  1:55 ` ori [this message]
2021-06-14 17:18   ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B7CD4D57FAF1705F3A5E6363CAADE67@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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