From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 15 08:51:20 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 9ABB616A403 for ; Fri, 15 Dec 2006 08:51:20 +0000 (UTC) (envelope-from ssouhlal@FreeBSD.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3135143CB2 for ; Fri, 15 Dec 2006 08:49:36 +0000 (GMT) (envelope-from ssouhlal@FreeBSD.org) Received: from [192.168.0.100] (c-67-188-127-3.hsd1.ca.comcast.net [67.188.127.3]) by elvis.mu.org (Postfix) with ESMTP id 37D091A4D93; Fri, 15 Dec 2006 00:51:16 -0800 (PST) Message-ID: <458261DE.2040607@FreeBSD.org> Date: Fri, 15 Dec 2006 00:50:38 -0800 From: Suleiman Souhlal User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051204) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Marc_L=F6rner?= References: <200612150937.37737.marc.loerner@hob.de> In-Reply-To: <200612150937.37737.marc.loerner@hob.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org 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 08:51:20 -0000 Marc Lörner 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 = (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 chunk 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. -- Suleiman