> > + /* > > + * Align on HPAGE_SIZE so "(gfn ^ pfn)& > > + * (HPAGE_SIZE-1) == 0" to allow KVM to take advantage > > + * of hugepages with NPT/EPT. > > + */ > > + new_block->host = qemu_memalign(1<< TARGET_HPAGE_BITS, size);
This should not be target dependent. i.e. it should be the host page size. > That is a little wasteful. How about a hint to mmap() requesting proper > alignment (MAP_HPAGE_ALIGN)? I'd kinda hope that we wouldn't need to. i.e. the host kernel is smart enough to automatically align large allocations anyway. This is probably a useful optimization regardless of KVM. Paul