From 60f3c86cf0bc244e9c0ecb2691aedccabd9c7972 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 20 Apr 1998 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1998-04-20 --- pc/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pc/main.c b/pc/main.c index bb6cf17b04c1064e68d4b4486cd800ce6c1fec4a..274f547f48ad499eea6131c230f7ec1f3eb22c9e 100644 --- a/pc/main.c +++ b/pc/main.c @@ -400,15 +400,20 @@ confinit(void) else pcnt = 60; } + /* + * Make sure terminals with low memory get at least + * 4MB on the first Image chunk allocation. + */ if(conf.npage*BY2PG < 16*MB) poolsetparam("Image", 0, 0, 4*1024*1024); /* - * give terminals lots of image memory, too; the dynamic allocation - * will balance the load properly, we hope. + * give terminals lots of image memory, too; the dynamic + * allocation will balance the load properly, we hope. + * be careful with 32-bit overflow. */ - poolsetparam("Image", BY2PG*conf.npage*(100-pcnt)/100, 0, 0); + poolsetparam("Image", (BY2PG*conf.npage/100)*(100-pcnt), 0, 0); } - poolsetparam("Main", BY2PG*conf.npage*(100-pcnt)/100, 0, 0); + poolsetparam("Main", (BY2PG*conf.npage/100)*(100-pcnt), 0, 0); conf.upages = (conf.npage*pcnt)/100; conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;