*BSD News Article 4215


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sunic!ugle.unit.no!aun.uninett.no!barsoom!barsoom!tih
From: tih@barsoom.nhh.no (Tom Ivar Helbekkmo)
Subject: Re: 386BSD: buffer space allocation -- a small bugfix.
Message-ID: <tih.714989648@barsoom>
Sender: news@barsoom.nhh.no (USENET News System)
Organization: Norwegian School of Economics
References: <tih.714982908@barsoom>
Date: Fri, 28 Aug 1992 08:14:08 GMT
Lines: 39

I wrote:

>Well, I guess it's my turn!  :-)  I'm now seeing the "kmem_map too
>small" panic here, when I try to copy a large file (a 1.44Mb floppy
>image) from an NFS-mounted device to a local hard disk.  I've tried
>making the changes that have been suggested, but that didn't help.
>(Sanity check in machdep.c, 500 to 1000 increase in vm_map.h.)

I've been looking at this stuff a bit more, and I've found something
that I don't really understand -- but which looks like a bug to me.

The function kmem_malloc() in /sys/vm/vm_kern.c has a parameter called
canwait, which the comment at the top indicates is set to non-zero
when kmem_malloc() is called from interrupt level, and the allocation
thus cannot be allowed to block.  Sounds reasonable to me, and also
sounds like a reason to panic if this happens.  However, I'm looking
at the following bit of code in kmem_malloc():

    if (vm_map_find(map, NULL, (vm_offset_t)0,
                    &addr, size, TRUE) != KERN_SUCCESS) {
            if (canwait)
                    panic("kmem_malloc: kmem_map too small");
            return(0);
    }

I confess I don't understand this virtual memory stuff too well, but
shouldn't that test be "if (!canwait)", though?  The way I read this,
if the caller says "I'd like to get this memory, but hey, I can wait,
so don't worry if I can't have it now", and we can't satisfy the
request at the moment, we panic.  If on the other hand, the request
was "Give me this memory, I've *gotta* have it right now!" we just
quietly fail.

Am I missing something important here?

-tih
--
Tom Ivar Helbekkmo, NHH, Bergen, Norway.  Telephone: +47-5-959205
Postmaster for domain nhh.no.   Internet mail: tih@barsoom.nhh.no