From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 14 02:07:55 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71C563EB; Fri, 14 Feb 2014 02:07:55 +0000 (UTC) Received: from mx11.netapp.com (mx11.netapp.com [216.240.18.76]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4D3641CEF; Fri, 14 Feb 2014 02:07:54 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.95,842,1384329600"; d="scan'208";a="102046970" Received: from vmwexceht02-prd.hq.netapp.com ([10.106.76.240]) by mx11-out.netapp.com with ESMTP; 13 Feb 2014 18:07:52 -0800 Received: from SACEXCMBX04-PRD.hq.netapp.com ([169.254.6.187]) by vmwexceht02-prd.hq.netapp.com ([10.106.76.240]) with mapi id 14.03.0123.003; Thu, 13 Feb 2014 18:07:51 -0800 From: "Gumpula, Suresh" To: John-Mark Gurney Subject: RE: malloc(9) and its alignment Thread-Topic: malloc(9) and its alignment Thread-Index: Ac8nlkbcQYqIQNi5TDadKkROsoUT6QAqkNoAAAYt8KAACiPngAApxumg Date: Fri, 14 Feb 2014 02:07:51 +0000 Message-ID: References: <1392214788.1145.52.camel@revolution.hippie.lan> <20140212220705.GV34851@funkthat.com> In-Reply-To: <20140212220705.GV34851@funkthat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.106.53.53] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "freebsd-hackers@freebsd.org" , Ian Lepore X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Feb 2014 02:07:55 -0000 Thanks for the explanation John. How about porting ARM way of handling req= uired alignment with creation of separate zones And allocating with uma_zalloc(zone) for AMD64 too for bus_dmamem_alloc? Thanks Suresh -----Original Message----- From: John-Mark Gurney [mailto:jmg@funkthat.com]=20 Sent: Wednesday, February 12, 2014 5:07 PM To: Gumpula, Suresh Cc: Ian Lepore; freebsd-hackers@freebsd.org Subject: Re: malloc(9) and its alignment Gumpula, Suresh wrote this message on Wed, Feb 12, 2014 at 19:40 +0000: > Thanks Ian for the reply. I will look at the ARM code, but I was think= ing why malloc(9) does not return bucket size aligned pointers.=20 Always returning bucket sizes aligned pointers may not be ideal for a cache= .. say you have a buffer of 512 bytes, where often only the first 128 bytes are used (but all 512 bytes may be)... If you always align at 51= 2, some cache lines will be more heavily used than others, reducing the eff= ective size of the cache... This is only one reason not aligning to size may be better... --=20 John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."