diff options
author | David Greenman <dg@FreeBSD.org> | 1994-02-07 07:44:42 +0000 |
---|---|---|
committer | David Greenman <dg@FreeBSD.org> | 1994-02-07 07:44:42 +0000 |
commit | 24ab273fa1ffe08ebaa458a57e383458a10ea869 (patch) | |
tree | d12587ea9c41bc1848d501866edafbbb3b792fb0 | |
parent | c1eeb17fc0cb6762a7efe07a8266beb2460528a0 (diff) | |
download | src-24ab273fa1ffe08ebaa458a57e383458a10ea869.tar.gz src-24ab273fa1ffe08ebaa458a57e383458a10ea869.zip |
Fixed calculation of physmem when the special MAXMEM kernel config overide
is used. This bug caused the buffer cache to be WAY too big when memory
was being restricted - resulting in hangs and other out of memory problems.
Notes
Notes:
svn path=/head/; revision=1116
-rw-r--r-- | sys/amd64/amd64/machdep.c | 9 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 066db2141cb6..e42a8aec13b5 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.32 1994/01/31 23:47:25 davidg Exp $ + * $Id: machdep.c,v 1.33 1994/02/01 10:03:43 davidg Exp $ */ #include "npx.h" @@ -1118,7 +1118,12 @@ init386(first) if (MAXMEM/4 < Maxmem) Maxmem = MAXMEM/4; #endif - physmem = pagesinbase + pagesinext; + /* + * Calculate number of physical pages, but account for Maxmem + * limitation above. + */ + physmem = pagesinbase + + (min(pagesinext + 0x100000/PAGE_SIZE, Maxmem) - 0x100000/PAGE_SIZE); /* call pmap initialization to make new kernel address space */ pmap_bootstrap (first, 0); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 066db2141cb6..e42a8aec13b5 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.32 1994/01/31 23:47:25 davidg Exp $ + * $Id: machdep.c,v 1.33 1994/02/01 10:03:43 davidg Exp $ */ #include "npx.h" @@ -1118,7 +1118,12 @@ init386(first) if (MAXMEM/4 < Maxmem) Maxmem = MAXMEM/4; #endif - physmem = pagesinbase + pagesinext; + /* + * Calculate number of physical pages, but account for Maxmem + * limitation above. + */ + physmem = pagesinbase + + (min(pagesinext + 0x100000/PAGE_SIZE, Maxmem) - 0x100000/PAGE_SIZE); /* call pmap initialization to make new kernel address space */ pmap_bootstrap (first, 0); |