home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / bsd / 4798 < prev    next >
Encoding:
Text File  |  1992-08-29  |  2.1 KB  |  51 lines

  1. Newsgroups: comp.unix.bsd
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!aun.uninett.no!barsoom!barsoom!tih
  3. From: tih@barsoom.nhh.no (Tom Ivar Helbekkmo)
  4. Subject: Re: 386BSD: buffer space allocation -- a small bugfix.
  5. Message-ID: <tih.714989648@barsoom>
  6. Sender: news@barsoom.nhh.no (USENET News System)
  7. Organization: Norwegian School of Economics
  8. References: <tih.714982908@barsoom>
  9. Date: Fri, 28 Aug 1992 08:14:08 GMT
  10. Lines: 39
  11.  
  12. I wrote:
  13.  
  14. >Well, I guess it's my turn!  :-)  I'm now seeing the "kmem_map too
  15. >small" panic here, when I try to copy a large file (a 1.44Mb floppy
  16. >image) from an NFS-mounted device to a local hard disk.  I've tried
  17. >making the changes that have been suggested, but that didn't help.
  18. >(Sanity check in machdep.c, 500 to 1000 increase in vm_map.h.)
  19.  
  20. I've been looking at this stuff a bit more, and I've found something
  21. that I don't really understand -- but which looks like a bug to me.
  22.  
  23. The function kmem_malloc() in /sys/vm/vm_kern.c has a parameter called
  24. canwait, which the comment at the top indicates is set to non-zero
  25. when kmem_malloc() is called from interrupt level, and the allocation
  26. thus cannot be allowed to block.  Sounds reasonable to me, and also
  27. sounds like a reason to panic if this happens.  However, I'm looking
  28. at the following bit of code in kmem_malloc():
  29.  
  30.     if (vm_map_find(map, NULL, (vm_offset_t)0,
  31.                     &addr, size, TRUE) != KERN_SUCCESS) {
  32.             if (canwait)
  33.                     panic("kmem_malloc: kmem_map too small");
  34.             return(0);
  35.     }
  36.  
  37. I confess I don't understand this virtual memory stuff too well, but
  38. shouldn't that test be "if (!canwait)", though?  The way I read this,
  39. if the caller says "I'd like to get this memory, but hey, I can wait,
  40. so don't worry if I can't have it now", and we can't satisfy the
  41. request at the moment, we panic.  If on the other hand, the request
  42. was "Give me this memory, I've *gotta* have it right now!" we just
  43. quietly fail.
  44.  
  45. Am I missing something important here?
  46.  
  47. -tih
  48. --
  49. Tom Ivar Helbekkmo, NHH, Bergen, Norway.  Telephone: +47-5-959205
  50. Postmaster for domain nhh.no.   Internet mail: tih@barsoom.nhh.no
  51.