From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrgWD-0001hX-PD for qemu-devel@nongnu.org; Tue, 16 Mar 2010 19:49:49 -0400 Received: from [199.232.76.173] (port=40788 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrgWD-0001hL-GK for qemu-devel@nongnu.org; Tue, 16 Mar 2010 19:49:49 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrgWC-0007F4-NH for qemu-devel@nongnu.org; Tue, 16 Mar 2010 19:49:49 -0400 Received: from mx20.gnu.org ([199.232.41.8]:57636) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NrgWA-0007ET-ST for qemu-devel@nongnu.org; Tue, 16 Mar 2010 19:49:48 -0400 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrgVT-00051N-4F for qemu-devel@nongnu.org; Tue, 16 Mar 2010 19:49:03 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH QEMU] Transparent Hugepage Support #2 Date: Tue, 16 Mar 2010 23:48:39 +0000 References: <20100316164641.GB5717@random.random> In-Reply-To: <20100316164641.GB5717@random.random> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003162348.40387.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Andrea Arcangeli , Avi Kivity > +#if defined(__linux__) && defined(__x86_64__) > +#define MAX_TRANSPARENT_HUGEPAGE_SIZE (2*1024*1024) > + if (size >= MAX_TRANSPARENT_HUGEPAGE_SIZE) I'd prefer something like: #if defined(__linux__) && defined(__x86_64__) /* [...Allow the host to use huge pages easily...]. */ #define PREFERRED_RAM_ALIGN (2*1024*1024) #endif qemu_ram_alloc(...) {... #ifdef PREFERRED_RAM_ALIGN if ((size & (PREFERRED_RAM_ALIGN - 1)) == 0) { new_block->host = qemu_memalign(...) } #endif i.e. separate the architecture specific knowledge from the generic alignment code. Paul