From owner-freebsd-current Mon Mar 20 14:19:04 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id OAA09280 for current-outgoing; Mon, 20 Mar 1995 14:19:04 -0800 Received: from Root.COM (implode.Root.COM [198.145.90.1]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id OAA09274 for ; Mon, 20 Mar 1995 14:19:00 -0800 Received: from corbin.Root.COM (corbin.Root.COM [198.145.90.18]) by Root.COM (8.6.8/8.6.5) with ESMTP id OAA27048; Mon, 20 Mar 1995 14:18:48 -0800 Received: from localhost (localhost [127.0.0.1]) by corbin.Root.COM (8.6.11/8.6.5) with SMTP id OAA02295; Mon, 20 Mar 1995 14:18:47 -0800 Message-Id: <199503202218.OAA02295@corbin.Root.COM> X-Authentication-Warning: corbin.Root.COM: Host localhost didn't use HELO protocol 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()? In-reply-to: Your message of "Mon, 20 Mar 95 15:03:02 MST." <9503202203.AA03201@cs.weber.edu> From: David Greenman Reply-To: davidg@Root.COM Date: Mon, 20 Mar 1995 14:18:47 -0800 Sender: current-owner@FreeBSD.org Precedence: bulk >> >> 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