Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Mar 1995 14:18:47 -0800
From:      David Greenman <davidg@Root.COM>
To:        terry@cs.weber.edu (Terry Lambert)
Cc:        wollman@halloran-eldar.lcs.mit.edu, current@FreeBSD.org
Subject:   Re: Why does kern_lkm.c use kmem_alloc()? 
Message-ID:  <199503202218.OAA02295@corbin.Root.COM>
In-Reply-To: Your message of "Mon, 20 Mar 95 15:03:02 MST." <9503202203.AA03201@cs.weber.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
>> >> Can anybody explain why kern_lkm.c uses kmem_alloc() to allocate
>> >> memory rather than malloc()?  Is it just because of the kernel
>> >> malloc()'s size limit?  (I'd really like for it to use malloc so that
>> >> I could tell how much memory is occupied by LKMs from `vmstat -m'.)
>> >
>> >Contiguous driver buffer space for DMA target.
>> 
>>    Contiguous? You mean _physically_ contiguous memory? kmem_alloc() has never
>> tried to return that.
>
>Virtually, at least initially, so that the loader can load the code
>contiguously in the address space in which it is to run.

   Ahh. Yes, kmem_alloc() is the thing to use in this case.

>Oh, and it wants to load the code page aligned.  kmem_alloc returns memory
>statring at the start of a page (or at least it used to and does in
>NetBSD).  This is actually a limitation in the linker with respect
>to allowable relocated code starts.

   Right, it allocates in terms of pages. Garrett should be able to use the
"size" field of modstat to see how much memory each module consumes (plus
whatever is malloc'd).

-DG



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503202218.OAA02295>