From nobody Tue Oct 28 02:08:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516116266330886.1428914659737; Tue, 16 Jan 2018 07:24:26 -0800 (PST) Received: from localhost ([::1]:40451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebT64-00081e-Ag for importer@patchew.org; Tue, 16 Jan 2018 10:24:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebS4j-0003kO-8f for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebS4e-0005Ud-Fa for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:53 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34837) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebS4e-0005Tv-8m for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:48 -0500 Received: by mail-wm0-x242.google.com with SMTP id r78so9011779wme.0 for ; Tue, 16 Jan 2018 06:18:48 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id u10sm1537758wrg.6.2018.01.16.06.18.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 06:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7VMu0VBZcgpewAsa8ffCUDPhjUklniJbNv3OMPwXEMQ=; b=ToqgyeuzefbfZpod+jpUSHEgEecY1kL21TA8XIYSYYMjJ4yjcXetqkLwWvSpybIT5Z nADd/H9vBJomfS2nZ2lnRhcS/nNvWoA8VUDWV2VUWERkBHkb35U8Tt/Xo8FFiyaOWeeq ZuWTFXdhJrfnoJnN8AmkOsQBZIjWwhl5n+cry09ZTPKTn+Si9XOLvqbTMRtPfi2ZL3cU pNIydqlduccyZFC5NBP8ax5J78wxG6ql/7Yrcpj8JmcWKjdwd6k94nbEX9Ie5EQ8qOwh l7CU4IMaF72jIV9BVefXNWVh3hEBgEafzp5dYl/URR/aiKKUwEmlojPN+/lNVUcC9FnL PcIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7VMu0VBZcgpewAsa8ffCUDPhjUklniJbNv3OMPwXEMQ=; b=XZlZzQI11zzQy0TmGa4LXC1KdpG7PKG+qV3zMasdPZjP+ztnUr9x3YF9eTzw7/gkcr OzumAowBH4TBplgWqAMTIP4g7Tth5uL6srSjAqmdBgbpF7WoQCHofeLosJewf9K+8L2n CcssIhsBLf/SXNuP7Ud7rclNby+d2VL8LSufdWxSSTPy/Lm+hu2plqKTm9FeB2Hr57gY Y8tSwGko2tITgp+gBjex+LzwBNWsKEu0ykL9+y9CP1kbhZkws9xsP2O47P4Y44ofjFkz yFdtnt1EzbukI2Hkv5AMkm6gCaqUxkmIZ0IXkU6Rq2Q4XYhMfetsKJxYNADGUTpILlXF AAXg== X-Gm-Message-State: AKwxytcX7gaku/UUHF/NJu+tYGZU+2Yhv739unm1kCRcZqP/3ficXLyO NbTi+uUzXRltHZSEttJkk1Ox/SMA X-Google-Smtp-Source: ACJfBotntenoNSi2ycpC/g4iLf1p3AJY1Q4Ni5Fl759ZgolYEJYdxBDOuAWfSFPiaGbdZTn4svwLsg== X-Received: by 10.28.14.71 with SMTP id 68mr12945025wmo.150.1516112326958; Tue, 16 Jan 2018 06:18:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 15:17:29 +0100 Message-Id: <1516112253-14480-48-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> References: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 47/51] find_ram_offset: Align ram_addr_t allocation on long boundaries 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: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" The dirty bitmaps are built from 'long's and there is fast-path code for synchronising the case where the RAMBlock is aligned to the start of a long boundary. Align the allocation to this boundary to cause the fast path to be used. Offsets before change: 11398@1515169675.018566:find_ram_offset size: 0x1e0000 @ 0x8000000 11398@1515169675.020064:find_ram_offset size: 0x20000 @ 0x81e0000 11398@1515169675.020244:find_ram_offset size: 0x20000 @ 0x8200000 11398@1515169675.024343:find_ram_offset size: 0x1000000 @ 0x8220000 11398@1515169675.025154:find_ram_offset size: 0x10000 @ 0x9220000 11398@1515169675.027682:find_ram_offset size: 0x40000 @ 0x9230000 11398@1515169675.032921:find_ram_offset size: 0x200000 @ 0x9270000 11398@1515169675.033307:find_ram_offset size: 0x1000 @ 0x9470000 11398@1515169675.033601:find_ram_offset size: 0x1000 @ 0x9471000 after change: 10923@1515169108.818245:find_ram_offset size: 0x1e0000 @ 0x8000000 10923@1515169108.819410:find_ram_offset size: 0x20000 @ 0x8200000 10923@1515169108.819587:find_ram_offset size: 0x20000 @ 0x8240000 10923@1515169108.823708:find_ram_offset size: 0x1000000 @ 0x8280000 10923@1515169108.824503:find_ram_offset size: 0x10000 @ 0x9280000 10923@1515169108.827093:find_ram_offset size: 0x40000 @ 0x92c0000 10923@1515169108.833045:find_ram_offset size: 0x200000 @ 0x9300000 10923@1515169108.833504:find_ram_offset size: 0x1000 @ 0x9500000 10923@1515169108.833787:find_ram_offset size: 0x1000 @ 0x9540000 Suggested-by: Paolo Bonzini Signed-off-by: Dr. David Alan Gilbert Message-Id: <20180105170138.23357-3-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- exec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exec.c b/exec.c index 5e2fb55..9f4f450 100644 --- a/exec.c +++ b/exec.c @@ -1678,7 +1678,11 @@ static ram_addr_t find_ram_offset(ram_addr_t size) RAMBLOCK_FOREACH(block) { ram_addr_t candidate, next =3D RAM_ADDR_MAX; =20 + /* Align blocks to start on a 'long' in the bitmap + * which makes the bitmap sync'ing take the fast path. + */ candidate =3D block->offset + block->max_length; + candidate =3D ROUND_UP(candidate, BITS_PER_LONG << TARGET_PAGE_BIT= S); =20 /* Search for the closest following block * and find the gap. --=20 1.8.3.1