*BSD News Article 10802


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA712 ; Sun, 07 Feb 93 01:01:28 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!uwm.edu!cs.utexas.edu!qt.cs.utexas.edu!news.Brown.EDU!stanley.cis.Brown.EDU!tim
From: tim@stanley.cis.Brown.EDU (Timothy Miller)
Newsgroups: comp.unix.bsd
Subject: [386BSD] Serious bug in vm handling, and fix
Date: 5 Feb 1993 21:59:26 GMT
Organization: Brown University
Lines: 22
Distribution: world
Message-ID: <1kunvu$mnv@cat.cis.Brown.EDU>
NNTP-Posting-Host: stanley.cis.brown.edu

Running 386BSD, my machine has chronically had the problem where it would just
hang indefinitely in the middle of processing taking a lot of memory. This has
gotten a lot better since switching to gnu malloc in libc and since fixing the
vm bug posted earlier, but it has still been happening, and worse, has happened
when the amount of memory used should be only a bit more than free physical
memory (and a lot less than total virtual memory). (My machine has 8M ram, BTW.)
After writing some test programs, debugging, etc., I have discovered that
vm_page_alloc, in vm/vm_page.c is not checking against vm_page_free_reserved,
and as a result the number of free pages goes down to 1, at which point the
pager can't page anything out because it needs more memory than that to allocate
the paging structs. This bug has been fixed in Mach 3.0's vm (along with
a number of other paging problems). The fix I've used on my machine has been
to change the test in vm_page_alloc where it checks if the free queue is empty
and returns 0 if so to also return 0 if
vm_page_free_count < vm_page_free_reserved && curproc != pageproc
(and also sys/proc.h has to be included). Thus the reserved pages are really
reserved, but they can be used by the pager, as intended. (Mach 3.0 fixes this
by testing for vm_privilege, not whether it's the pager, but vm_privilege isn't
in 386BSD.) I'm probably also going to be merging in the other fixes from the
3.0 pager into my system, as they also look as though they will help things
quite a bit.
   Tim