From nobody Tue Feb 10 00:59:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579002807; cv=none; d=zohomail.com; s=zohoarc; b=gNnFEgMP2sj4DyZDypxKvqvLvD/Wr2lxCZBLiuVbTjkKIYtHD8aGsT6EDI6Ei4AF+AyB52dWOvUt/TRoLYuU07FkSujPl5ENFwgqei/Eg5NcmyZ3rKk4o6GhKf0WwqB1CG1+T1GVm+6sqRLugL7wZLZsqVTLYrIzBeS7w4033/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579002807; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8qROkM+rasi7lNorWAKRMCcUO5bof/IxBRI/hTT2Oxs=; b=mLG2uUyLld9obq3fxLD+swkT/BiPxJ246N1pjdWXHk9M9xbfMF1r5NDLhGc6kCvaM1RVCDyDNQ4Piy3u9KJ9Izpp5dyFFlSjij0VowvGCLekA1+i+cN5S7l3furbsoqq5TbPAzZkv5qsB/nsIZeLffkx1A8f+W4Z/HrtpduhjD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579002807760873.304428815072; Tue, 14 Jan 2020 03:53:27 -0800 (PST) Received: from localhost ([::1]:37964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irKlB-0004BO-UD for importer@patchew.org; Tue, 14 Jan 2020 06:53:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56022) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irKZi-0006Zz-9b for qemu-devel@nongnu.org; Tue, 14 Jan 2020 06:41:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irKZe-0003QS-Kq for qemu-devel@nongnu.org; Tue, 14 Jan 2020 06:41:34 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:30485 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irKZe-0003QI-HU for qemu-devel@nongnu.org; Tue, 14 Jan 2020 06:41:30 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-277-NdfgoCgsNVmpNhAlr8xhDQ-1; Tue, 14 Jan 2020 06:41:28 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB7E8801E6C; Tue, 14 Jan 2020 11:41:26 +0000 (UTC) Received: from secure.mitica (ovpn-116-207.ams2.redhat.com [10.36.116.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 413CD5DA70; Tue, 14 Jan 2020 11:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579002090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8qROkM+rasi7lNorWAKRMCcUO5bof/IxBRI/hTT2Oxs=; b=IRsqmwOQzjULEBhKBsoJYsEeRPKgUypXr8dkFFdxE1fSKuD2e4WZoyERWn6IUSbFZKsRBW rPF8elUW0t1KVuFg+9K2Gn3y6VjEfgnElELOQuBkaqtu9df9WQem4uvcCwJudRTp54wM+8 7/qn5XVOTflRKCHUHJz5P/bOsyWw24A= From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 15/30] migration/postcopy: reduce memset when it is zero page and matches_target_page_size Date: Tue, 14 Jan 2020 12:39:11 +0100 Message-Id: <20200114113926.3556-16-quintela@redhat.com> In-Reply-To: <20200114113926.3556-1-quintela@redhat.com> References: <20200114113926.3556-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: NdfgoCgsNVmpNhAlr8xhDQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Corey Minyard , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Stefan Weil , Richard Henderson , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Wei Yang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , David Gibson , Jason Wang , Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Wei Yang In this case, page_buffer content would not be used. Skip this to save some time. Signed-off-by: Wei Yang Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 5cd066467c..bdb0316892 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4126,7 +4126,13 @@ static int ram_load_postcopy(QEMUFile *f) switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { case RAM_SAVE_FLAG_ZERO: ch =3D qemu_get_byte(f); - memset(page_buffer, ch, TARGET_PAGE_SIZE); + /* + * Can skip to set page_buffer when + * this is a zero page and (block->page_size =3D=3D TARGET_PAG= E_SIZE). + */ + if (ch || !matches_target_page_size) { + memset(page_buffer, ch, TARGET_PAGE_SIZE); + } if (ch) { all_zero =3D false; } --=20 2.24.1