From nobody Mon Feb 9 01:20:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.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=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1573130523; cv=none; d=zoho.com; s=zohoarc; b=jSBVUm1xzw/j43hkTsWj3/5B2mCxKt/9p8M3tUdcCq1L6e460z4W/x04fSEUJ70MwKmPNO8EgB7fXbbtnyZhpGshVDek+457uEzvJBGsTAM1+p/UY0cU3gc+jsLuUfW3r4F1u0HRk7el/reqWb/xWQdxvANU6pzm4ntVkYRpJKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573130523; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+JV4xiUnW1a4LEpC40oRKvonmy+92bsg1HZ8/5hzXe4=; b=TC5Ey4VJJoMmfHCw4fQMjoTqlDBYi0Ri4mEMevUyTLZ/IeDgdNiadEsg3DYN7VB/ahECHXwwHFLAQL8mSLMBsBMhRsGbCSC9NbTkWI8hoOUuGSdAjgFNpsEGisDSHeo/WXxoq/D4e+aJtI3G3uMn8B5m9GsNRjW7oPChVyk+bW8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1573130523153763.0626056868268; Thu, 7 Nov 2019 04:42:03 -0800 (PST) Received: from localhost ([::1]:41644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSh6v-00062a-St for importer@patchew.org; Thu, 07 Nov 2019 07:42:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58910) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSh4e-0003wb-Me for qemu-devel@nongnu.org; Thu, 07 Nov 2019 07:39:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSh4d-0002qa-Nb for qemu-devel@nongnu.org; Thu, 07 Nov 2019 07:39:40 -0500 Received: from mga06.intel.com ([134.134.136.31]:63430) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iSh4d-0002nd-Fw for qemu-devel@nongnu.org; Thu, 07 Nov 2019 07:39:39 -0500 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 04:39:36 -0800 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga005.jf.intel.com with ESMTP; 07 Nov 2019 04:39:35 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,278,1569308400"; d="scan'208";a="377408585" From: Wei Yang To: quintela@redhat.com, dgilbert@redhat.com Subject: [Patch v2 1/6] migration/postcopy: reduce memset when it is zero page and matches_target_page_size Date: Thu, 7 Nov 2019 20:39:02 +0800 Message-Id: <20191107123907.29791-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107123907.29791-1-richardw.yang@linux.intel.com> References: <20191107123907.29791-1-richardw.yang@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 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: qemu-devel@nongnu.org, Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Acked-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 99a98b2da4..7938a643d9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4091,7 +4091,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.17.1