From patchwork Thu Apr 21 19:50:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 8903611 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5CB659F39A for ; Thu, 21 Apr 2016 19:50:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C860720303 for ; Thu, 21 Apr 2016 19:50:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C7027202FF for ; Thu, 21 Apr 2016 19:50:22 +0000 (UTC) Received: from localhost ([::1]:47078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atKcH-00088Y-R0 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Apr 2016 15:50:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atKc8-000823-S0 for qemu-devel@nongnu.org; Thu, 21 Apr 2016 15:50:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atKc5-0007dM-Jr for qemu-devel@nongnu.org; Thu, 21 Apr 2016 15:50:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:48363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atKc5-0007cm-B7 for qemu-devel@nongnu.org; Thu, 21 Apr 2016 15:50:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F23C2AB08; Thu, 21 Apr 2016 19:50:04 +0000 (UTC) To: Christoffer Dall , Peter Maydell , "Michael S. Tsirkin" , qemu-devel@nongnu.org References: <20160421162348.GA24178@cbox> From: Alexander Graf Message-ID: <57192EED.2040501@suse.de> Date: Thu, 21 Apr 2016 21:50:05 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160421162348.GA24178@cbox> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Subject: Re: [Qemu-devel] Performance regression using KVM/ARM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 21.04.16 18:23, Christoffer Dall wrote: > Hi, > > Commit 9fac18f (oslib: allocate PROT_NONE pages on top of RAM, > 2015-09-10) had the unfortunate side effect that memory slots registered > with KVM no longer contain a userspace address that is aligned to a 2M > boundary, causing the use of THP to fail in the kernel. > > I fail to see where in the QEMU code we should be asking for a 2M > alignment of our memory region. Can someone help pointing me to the > right place to fix this or suggest a patch? > > This causes a performance regssion of hackbench on KVM/ARM of about 62% > compared to the workload running with THP. > > We have verified that this is indeed the cause of the failure by adding > various prints to QEMU and the kernel, but unfortunatley my QEMU > knowledge is not sufficient for me to fix it myself. > > Any help would be much appreciated! The code changed quite heavily since I last looked at it, but could you please try whether the (untested) patch below makes a difference? Alex diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 0b4cc7f..24e73b1 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -36,7 +36,7 @@ size_t qemu_fd_getpagesize(int fd) } #endif - return getpagesize(); + return 2 * 1024 * 1024; } void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared)