Date: Sat, 7 Mar 1998 01:05:15 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: dg@root.com Cc: semen@iclub.nsu.ru, mike@smith.net.au, freebsd-hackers@FreeBSD.ORG Subject: Re: Are mbufs aligned or bounded on something? Message-ID: <199803070105.SAA25317@usr09.primenet.com> In-Reply-To: <199803060654.WAA24313@implode.root.com> from "David Greenman" at Mar 5, 98 10:54:13 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> >By the way: if i need aligned memory, should i use contigmalloc(), or > >better to use malloc, and align block by hands? > > All memory returned by malloc() is guaranteed to be power of two aligned > and won't span a page boundry if <= a page in size; there are many places in > the kernel that rely on this. > If you need a large chunk of memory that must be physically contiguous, > then use contigmalloc(). If you need to use contigmalloc(), then you should allocate at boot time. The current kernel does not support kernel page relocation as a means of defragmenting kernel memory to guarantee you the ability to do a contigmalloc() at some later date. Doing this is not terribly hard, but then leaves you with a contiguous region fragmentation problem (which would potentially leave you in the same boat, just less frequently than the current "always") if you alloc and dealloc frequently, and compete with other hardware for contig regions of different sizes. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803070105.SAA25317>