> +#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