From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 15 09:19:44 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3052716A40F; Fri, 15 Dec 2006 09:19:44 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF0A643C9E; Fri, 15 Dec 2006 09:18:02 +0000 (GMT) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [193.217.134.54] (account mc467741@c2i.net HELO [10.0.0.249]) by mailfe01.swip.net (CommuniGate Pro SMTP 5.0.12) with ESMTPA id 337521687; Fri, 15 Dec 2006 10:19:41 +0100 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Fri, 15 Dec 2006 10:19:20 +0100 User-Agent: KMail/1.7 References: <200612150937.37737.marc.loerner@hob.de> <458261DE.2040607@FreeBSD.org> In-Reply-To: <458261DE.2040607@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200612151019.22622.hselasky@c2i.net> Cc: Suleiman Souhlal , Marc =?iso-8859-1?q?L=F6rner?= Subject: Re: Allocate aligned memory X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Dec 2006 09:19:44 -0000 On Friday 15 December 2006 09:50, Suleiman Souhlal wrote: > Marc L=F6rner wrote: > > Hello all, > > > > I want to allocate 120KB of memory thats aligned to 32KB. > > I already saw/found the function contigmalloc, now my question is, why > > following functioncall never does return with an resulting address, > > instead null is returned? > > > > unsigned long *p =3D (unsigned long*) > > contigmalloc(120*1024, M_DEVBUF, M_WAITOK, 0, (1<<22), 32*1024, > > 1024*1024); > > Have you considered the fact that there might be no 32K-aligned 120KB chu= nk > of memory in the range you specified? > > My suggestion is to make the your high limit (currently 1 << 22) MUCH > higher, if possible. Also, getting rid of the 1MB boundary might help. > PS: contigmalloc is on the way out. Please use "man bus_dma" instead. For a= n=20 example see: http://www.turbocat.net/~hselasky/isdn4bsd/sources/src/sys/dev/usb/usb_subr= =2Ec And the function "usbd_mem_alloc_sub()". =2D-HPS