Received: by 2002:a19:c345:0:0:0:0:0 with SMTP id t66csp1003659lff; Fri, 10 Jan 2020 09:51:31 -0800 (PST) X-Google-Smtp-Source: APXvYqw2Mch4k+f4rxikcVHf6a+8grQTDp+N65jN5rlcaZd5kPtXwCN0Ey5uMbqwjpXNiyAKmRWq X-Received: by 2002:a05:620a:136e:: with SMTP id d14mr4325425qkl.342.1578678691565; Fri, 10 Jan 2020 09:51:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578678691; cv=none; d=google.com; s=arc-20160816; b=sdHJyGTLqOZBWNxRQCjgTSKHi8N6M6CWgoAY0Xeujc7RGyODt83dXODJb90ZBHtVPN aGUBXxoi7SdSj4hi6dGbj5jALj9lXzS4nicKZAVUsyUR0jWBa90jXzYZCkxL8qnezmu2 h613LoKWHzrUeGv/pX/xa1UawbmENGvAmiMiSjuqKnZERlzGqOixVqopJ5y6gx3T2HtT 0HCs6BpRLQ3L9vKQXU8d9pBURDCgTsAxgWj17MAJekj0DPcfy6iXBUtYLOquVU85WHH4 ppCZZ+tdZYW92suXJYcCXK/ax66WvGbs+qHb2A9YhqCT+JDGw6MrkV2Eaj+/JJW2pohs wkaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OisJlcbsKKct9fJ9vFighsrr4pIY6/pz8QAKoFLGOWk=; b=SPiIap0463qA4l4S8TyhzpoeDvDoGin8O+IdjjA9vGuiY8TwDmvNgMMMcQ8EpkpXae yE3wvMdo9bK2qpmvED6w7AyI7W0T3ocOX3hC4gLsnd5KVsJcp6uqaQvpw36fEouwhDJU o99rIvv+LV3uwLyYhkVQlcDUYXDRQ0eJp3gH7h+9jGnxznygyOMlSwifLGjPf9blDXYN uDLyaPrHk0q8mJHzgTPlzVl0y0CGh8yXsy7xPAJ2mzdEC4k0RHif+vF5Tt5vwtFltT2L wCInKEhrYKOZFm8ik1c5v9sTIPZplnEUeI0fOmvdoWjAKpCZ3bTRSgmGWua7TLc8RF4i tdRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=NYHDnDMJ; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i5si1490932qtb.40.2020.01.10.09.51.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jan 2020 09:51:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=NYHDnDMJ; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:50054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipyRW-0002mJ-G3 for alex.bennee@linaro.org; Fri, 10 Jan 2020 12:51:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50437) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipyBc-0006Qz-QN for qemu-arm@nongnu.org; Fri, 10 Jan 2020 12:35:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipyBb-0005pJ-LO for qemu-arm@nongnu.org; Fri, 10 Jan 2020 12:35:04 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50464 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ipyBb-0005nk-F1 for qemu-arm@nongnu.org; Fri, 10 Jan 2020 12:35:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578677703; 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=OisJlcbsKKct9fJ9vFighsrr4pIY6/pz8QAKoFLGOWk=; b=NYHDnDMJvIVp0+g9MFCPk3tNxe1Hx60Dfeb7Adu53IlwJIaEedkgoYKz9bQVta/N8KM2ac pVoMz4zirjgCbMBBO4Dgr30OLk88ZtH8q9rTfWvFTqWAcmFvv0m94SW3Gtm6zvKGTy1Vbc giPuhlpATFVQINn0aToBJTTwz+pFyZ8= 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-15-f4aR5GAHPNm5748OnqYHmw-1; Fri, 10 Jan 2020 12:34:59 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C66A800D48; Fri, 10 Jan 2020 17:34:57 +0000 (UTC) Received: from secure.mitica (ovpn-116-240.ams2.redhat.com [10.36.116.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1224119C4F; Fri, 10 Jan 2020 17:34:14 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 15/28] migration/postcopy: reduce memset when it is zero page and matches_target_page_size Date: Fri, 10 Jan 2020 18:32:02 +0100 Message-Id: <20200110173215.3865-16-quintela@redhat.com> In-Reply-To: <20200110173215.3865-1-quintela@redhat.com> References: <20200110173215.3865-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: f4aR5GAHPNm5748OnqYHmw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII 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.120 X-BeenThere: qemu-arm@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 , Corey Minyard , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , Juan Quintela , Peter Maydell , Stefan Weil , Jason Wang , "Michael S. Tsirkin" , "Dr. David Alan Gilbert" , Wei Yang , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, David Gibson , Marcel Apfelbaum , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Stefan Berger , Andrzej Zaborowski , Richard Henderson Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: 0+hkJ4lk6cLY 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 31d21b7f6b..6702a3203e 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