From owner-freebsd-hackers Thu Aug 13 10:51:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA07549 for freebsd-hackers-outgoing; Thu, 13 Aug 1998 10:51:31 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from hda.hda.com (hda-bicnet.bicnet.net [208.220.66.37]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA07543 for ; Thu, 13 Aug 1998 10:51:26 -0700 (PDT) (envelope-from dufault@hda.hda.com) Received: (from dufault@localhost) by hda.hda.com (8.8.5/8.8.5) id NAA19891; Thu, 13 Aug 1998 13:47:51 -0400 (EDT) From: Peter Dufault Message-Id: <199808131747.NAA19891@hda.hda.com> Subject: Re: Allocating memory in a network device driver In-Reply-To: <199808122248.PAA09142@bubba.whistle.com> from Archie Cobbs at "Aug 12, 98 03:48:23 pm" To: archie@whistle.com (Archie Cobbs) Date: Thu, 13 Aug 1998 13:47:46 -0400 (EDT) Cc: Emmanuel.Duros@sophia.inria.fr, freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL25 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I have seen in many device drivers allocating memory in the following > > way: > > > > u_char *buf; > > buf = malloc( BUFSIZ, M_DEVBUF, M_NOWAIT); > > > > Do we get the same result with : ? > > > > u_char buf[BUFSIZ]; > > The kernel malloc works just like the libc malloc... The allocation is preferred for large objects since an auto object will be on the kernel stack. The kernel stack is a finite resource and (in general and not FBSD specifically) on some systems isn't shared across multiple processors. Peter -- Peter Dufault (dufault@hda.com) Realtime development, Machine control, HD Associates, Inc. Safety critical systems, Agency approval To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message