From patchwork Tue Apr 17 13:23:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balamuruhan S X-Patchwork-Id: 10345035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41AF76039A for ; Tue, 17 Apr 2018 13:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AEE52239C for ; Tue, 17 Apr 2018 13:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6D4223A0; Tue, 17 Apr 2018 13:26:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_NUMERIC_HELO autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3359223A7 for ; Tue, 17 Apr 2018 13:26:49 +0000 (UTC) Received: from localhost ([::1]:38734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8QdE-0001sR-U7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 17 Apr 2018 09:26:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8Qad-0008E8-FH for qemu-devel@nongnu.org; Tue, 17 Apr 2018 09:24:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8QaY-0004Dx-Sy for qemu-devel@nongnu.org; Tue, 17 Apr 2018 09:24:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53142 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f8QaY-0004De-Ne for qemu-devel@nongnu.org; Tue, 17 Apr 2018 09:24:02 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3HDJe4J058072 for ; Tue, 17 Apr 2018 09:24:02 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hdekvhs9y-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 09:23:59 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 14:23:52 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 14:23:49 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3HDNmH88520036; Tue, 17 Apr 2018 13:23:48 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C4A111C052; Tue, 17 Apr 2018 14:15:45 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 092C111C04C; Tue, 17 Apr 2018 14:15:44 +0100 (BST) Received: from 9.122.211.20 (unknown [9.122.211.20]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Apr 2018 14:15:43 +0100 (BST) From: Balamuruhan S To: qemu-devel@nongnu.org Date: Tue, 17 Apr 2018 18:53:17 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180417132317.6910-1-bala24@linux.vnet.ibm.com> References: <20180417132317.6910-1-bala24@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041713-0012-0000-0000-000005CBD602 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041713-0013-0000-0000-0000194820E2 Message-Id: <20180417132317.6910-2-bala24@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-17_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804170120 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v2 1/1] migration: calculate expected_downtime with ram_bytes_remaining() 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: amit.shah@redhat.com, dgibson@redhat.com, Balamuruhan S , dgilbert@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP expected_downtime value is not accurate with dirty_pages_rate * page_size, using ram_bytes_remaining would yeild it correct. Signed-off-by: Balamuruhan S --- migration/migration.c | 6 +++--- migration/migration.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 52a5092add..4d866bb920 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -614,7 +614,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) } if (s->state != MIGRATION_STATUS_COMPLETED) { - info->ram->remaining = ram_bytes_remaining(); + info->ram->remaining = s->ram_bytes_remaining; info->ram->dirty_pages_rate = ram_counters.dirty_pages_rate; } } @@ -2227,6 +2227,7 @@ static void migration_update_counters(MigrationState *s, transferred = qemu_ftell(s->to_dst_file) - s->iteration_initial_bytes; time_spent = current_time - s->iteration_start_time; bandwidth = (double)transferred / time_spent; + s->ram_bytes_remaining = ram_bytes_remaining(); s->threshold_size = bandwidth * s->parameters.downtime_limit; s->mbps = (((double) transferred * 8.0) / @@ -2237,8 +2238,7 @@ static void migration_update_counters(MigrationState *s, * recalculate. 10000 is a small enough number for our purposes */ if (ram_counters.dirty_pages_rate && transferred > 10000) { - s->expected_downtime = ram_counters.dirty_pages_rate * - qemu_target_page_size() / bandwidth; + s->expected_downtime = s->ram_bytes_remaining / bandwidth; } qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/migration.h b/migration/migration.h index 8d2f320c48..8584f8e22e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -128,6 +128,7 @@ struct MigrationState int64_t downtime_start; int64_t downtime; int64_t expected_downtime; + int64_t ram_bytes_remaining; bool enabled_capabilities[MIGRATION_CAPABILITY__MAX]; int64_t setup_time; /*