Subject: metadata cache and memory fragmentation
To: None <tech-kern@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 05/13/2004 11:48:50
The interaction of the new metadata cache and the page cache seems to lead
to significant kernel memory fragmentation.  Because most requests from
the metadata cache are small, larger regions of free memory are split up;
when the metadata cache returns memory, it does so one buffer at a time
(typically just one or two pages) and this means that even when we have
quite a bit of memory free, very little of it may be contiguous.  This
causes problems for drivers like the USB drivers and the drivers for
various cardbus cards.

As an experiment, if you're having "can't allocate..." problems with
such a driver, try removing the device in question, reducing
vm.bufmem_hiwater significantly, and running something that allocates,
then frees a good-zies hunk of memory.  You will probably then find that
you can reconnect the device and everything will work fine.

I'm not sure how to address this issue.  I'd love to hear ideas.

-- 
 Thor Lancelot Simon	                                      tls@rek.tjls.com
   But as he knew no bad language, he had called him all the names of common
 objects that he could think of, and had screamed: "You lamp!  You towel!  You
 plate!" and so on.              --Sigmund Freud