kernel memory

Peter Wemm peter at wemm.org
Sat Jul 23 19:17:26 GMT 2005


On Saturday 23 July 2005 12:12 pm, Peter Wemm wrote:
> On Thursday 21 July 2005 11:58 am, Petri Helenius wrote:
> > Peter Wemm wrote:
> > >2GB for paged kernel memory.  But in addition we access memory via
> > > the direct map area to avoid the need for temporary mappings in
> > > many cases. uma (malloc, mbufs) etc use this, as does the sfbuf
> > > temporary mapping system.
> >
> > So there is no limitation for malloced memory? Say if my driver
> > would like to have 4 or 8 gig lookup cache that would work?
>
> AARGH.  I've just found a bug/feature in the memory allocator.
>
> There are two code paths, one for small (<PAGE_SIZE) allocations,
> which uses the direct map allocations instead of kvm allocations, and
> the other large chunk allocator that simply allocates pages at a time
> from kvm. :-(
>
> I suspect this is because malloc's semantics depend on objects being
> contiguous. The direct map method would allocate physically
> discontiguous pages.
>
> So, if you allocated your lookup cache in <4K chunks, you could have
> as much as you like. :-/

Make that <= 4K.  A 4K allocation should be fine.  But I suspect that is 
still going to be a pain to deal with.
-- 
Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


More information about the freebsd-amd64 mailing list