ref: 05d5f147584c2b16e3754ad492384aff86a16b62
parent: efc7a9a729b075aab06bc24ae778304ad98c3ab6
author: Ori Bernstein <[email protected]>
date: Fri Aug 12 08:01:46 EDT 2022
9: compute available kernel pages using sizeof(Proc*) procs come from the dynamic pools, so we don't need to remove the memory used by possible procs from the total available.
--- a/sys/src/9/bcm/main.c
+++ b/sys/src/9/bcm/main.c
@@ -237,7 +237,7 @@
kpages = conf.npage - conf.upages;
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/bcm64/main.c
+++ b/sys/src/9/bcm64/main.c
@@ -108,7 +108,7 @@
kpages = conf.npage - conf.upages;
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/cycv/main.c
+++ b/sys/src/9/cycv/main.c
@@ -117,7 +117,7 @@
kmem = 200*1024*1024;
conf.upages = conf.npage - kmem/BY2PG;
kmem -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image);
mainmem->maxsize = kmem;
imagmem->maxsize = kmem - (kmem/10);
--- a/sys/src/9/imx8/main.c
+++ b/sys/src/9/imx8/main.c
@@ -206,7 +206,7 @@
kpages = conf.npage - conf.upages;
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/kw/main.c
+++ b/sys/src/9/kw/main.c
@@ -448,7 +448,7 @@
kpages = conf.npage - conf.upages;
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/mtx/main.c
+++ b/sys/src/9/mtx/main.c
@@ -233,7 +233,7 @@
*/
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/omap/main.c
+++ b/sys/src/9/omap/main.c
@@ -467,7 +467,7 @@
kpages = conf.npage - conf.upages;
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/pc/main.c
+++ b/sys/src/9/pc/main.c
@@ -216,7 +216,7 @@
*/
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/pc64/main.c
+++ b/sys/src/9/pc64/main.c
@@ -85,7 +85,7 @@
* datastructures. Mntcache and Mntrpc are not accounted for.
*/
kpages *= BY2PG;
- kpages -= conf.nproc*sizeof(Proc)
+ kpages -= conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -737,7 +737,7 @@
procalloc.tab = xalloc((conf.nproc+1)*sizeof(Proc*));
if(procalloc.tab == nil){
xsummary();
- panic("cannot allocate %lud procs (%ludMB)", conf.nproc, conf.nproc*sizeof(Proc)/(1024*1024));
+ panic("cannot allocate proctab for %lud procs", conf.nproc);
}
memset(procalloc.tab, 0, (conf.nproc+1)*sizeof(Proc*));
pidinit();
--- a/sys/src/9/ppc/main.c
+++ b/sys/src/9/ppc/main.c
@@ -296,7 +296,7 @@
*/
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/sgi/main.c
+++ b/sys/src/9/sgi/main.c
@@ -362,7 +362,7 @@
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/teg2/main.c
+++ b/sys/src/9/teg2/main.c
@@ -670,7 +670,7 @@
kpages = conf.npage - conf.upages;
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/xen/main.c
+++ b/sys/src/9/xen/main.c
@@ -309,7 +309,7 @@
*/
kpages *= BY2PG;
kpages -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image)
+ conf.nswap
+ conf.nswppo*sizeof(Page*);
--- a/sys/src/9/zynq/main.c
+++ b/sys/src/9/zynq/main.c
@@ -187,7 +187,7 @@
kmem = 200*1024*1024;
conf.upages = conf.npage - kmem/BY2PG;
kmem -= conf.upages*sizeof(Page)
- + conf.nproc*sizeof(Proc)
+ + conf.nproc*sizeof(Proc*)
+ conf.nimage*sizeof(Image);
mainmem->maxsize = kmem;
imagmem->maxsize = kmem - (kmem/10);