From 8745e29e15ac31945c5711637879b8422ee774ee Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 18 Mar 2012 20:12:29 +0100 Subject: [PATCH] make pc kernels graphics image memory pool unlimited by default, add *imagemaxmb= kernel parameter --- sys/man/8/plan9.ini | 4 ++++ sys/src/9/pc/main.c | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sys/man/8/plan9.ini b/sys/man/8/plan9.ini index 09f639608..e91abb517 100644 --- a/sys/man/8/plan9.ini +++ b/sys/man/8/plan9.ini @@ -667,6 +667,10 @@ Terminals use more kernel memory because .IR draw (3) maintains its graphic images in kernel memory. This deprecated option is rarely necessary in newer kernels. +.SS \fL*imagemaxmb=\fIvalue\fP +This limits the maximum amount of memory (in megabytes) the graphics +image memory pool can grow. The default is unlimited for terminals +and cpu servers. .SS \fL*nomce=\fIvalue\fP If machine check exceptions are supported by the processor, then they are enabled by default. diff --git a/sys/src/9/pc/main.c b/sys/src/9/pc/main.c index a1ae7a918..2fecf5df0 100644 --- a/sys/src/9/pc/main.c +++ b/sys/src/9/pc/main.c @@ -415,7 +415,7 @@ confinit(void) * 4MB on the first Image chunk allocation. */ if(conf.npage*BY2PG < 16*MB) - imagmem->minarena = 4*1024*1024; + imagmem->minarena = 4*MB; } /* @@ -440,13 +440,16 @@ confinit(void) + conf.nswap + conf.nswppo*sizeof(Page*); mainmem->maxsize = kpages; - if(!cpuserver){ - /* - * give terminals lots of image memory, too; the dynamic - * allocation will balance the load properly, hopefully. - * be careful with 32-bit overflow. - */ - imagmem->maxsize = kpages; + + /* + * the dynamic allocation will balance the load properly, + * hopefully. be careful with 32-bit overflow. + */ + imagmem->maxsize = mainmem->maxsize; + if(p = getconf("*imagemaxmb")){ + imagmem->maxsize = strtol(p, nil, 0)*MB; + if(imagmem->maxsize > mainmem->maxsize) + imagmem->maxsize = mainmem->maxsize; } }