From patchwork Fri Oct 18 00:48:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 1179084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46vS9n2BdLz9sPp for ; Fri, 18 Oct 2019 11:50:04 +1100 (AEDT) Received: from localhost ([::1]:34406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLGSv-0004Ti-SC for incoming@patchwork.ozlabs.org; Thu, 17 Oct 2019 20:50:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49251) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLGSJ-0004Px-Fs for qemu-devel@nongnu.org; Thu, 17 Oct 2019 20:49:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLGSI-00017m-IU for qemu-devel@nongnu.org; Thu, 17 Oct 2019 20:49:23 -0400 Received: from mga06.intel.com ([134.134.136.31]:15620) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iLGSI-00010g-B2 for qemu-devel@nongnu.org; Thu, 17 Oct 2019 20:49:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2019 17:49:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,309,1566889200"; d="scan'208";a="199552630" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga003.jf.intel.com with ESMTP; 17 Oct 2019 17:49:20 -0700 From: Wei Yang To: quintela@redhat.com, dgilbert@redhat.com Subject: [PATCH 4/6] migration/postcopy: set all_zero to true on the first target page Date: Fri, 18 Oct 2019 08:48:48 +0800 Message-Id: <20191018004850.9888-5-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018004850.9888-1-richardw.yang@linux.intel.com> References: <20191018004850.9888-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" For the first target page, all_zero is set to true for this round check. After target_pages introduced, we could leverage this variable instead of checking the address offset. Signed-off-by: Wei Yang Reviewed-by: Dr. David Alan Gilbert --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 5c05376d8d..b5759793a9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4067,7 +4067,7 @@ static int ram_load_postcopy(QEMUFile *f) page_buffer = postcopy_host_page + ((uintptr_t)host & (block->page_size - 1)); /* If all TP are zero then we can optimise the place */ - if (!((uintptr_t)host & (block->page_size - 1))) { + if (target_pages == 1) { all_zero = true; } else { /* not the 1st TP within the HP */