From patchwork Tue Jan 22 15:05:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balamuruhan S X-Patchwork-Id: 10776159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FD661399 for ; Tue, 22 Jan 2019 19:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BBCD2B719 for ; Tue, 22 Jan 2019 19:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EB4C2B7AD; Tue, 22 Jan 2019 19:19:14 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0A2812B719 for ; Tue, 22 Jan 2019 19:19:14 +0000 (UTC) Received: from localhost ([127.0.0.1]:47695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm1Zp-0005h0-8F for patchwork-qemu-devel@patchwork.kernel.org; Tue, 22 Jan 2019 14:19:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm14g-0004NB-Dw for qemu-devel@nongnu.org; Tue, 22 Jan 2019 13:47:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gm14e-0005BL-EY for qemu-devel@nongnu.org; Tue, 22 Jan 2019 13:47:02 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58550 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 1gm14c-0004FL-BA for qemu-devel@nongnu.org; Tue, 22 Jan 2019 13:46:58 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0MF5i2d091377 for ; Tue, 22 Jan 2019 10:06:31 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q63kq5kf5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 22 Jan 2019 10:06:29 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Jan 2019 15:06:11 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 22 Jan 2019 15:06:07 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0MF66LB64225398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Jan 2019 15:06:06 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53E2EA405B; Tue, 22 Jan 2019 15:06:06 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F9AAA4054; Tue, 22 Jan 2019 15:06:05 +0000 (GMT) Received: from dhcp-9-109-245-114.in.ibm.com (unknown [9.124.35.98]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jan 2019 15:06:05 +0000 (GMT) From: bala24@linux.vnet.ibm.com To: qemu-devel@nongnu.org Date: Tue, 22 Jan 2019 20:35:43 +0530 X-Mailer: git-send-email 2.14.5 In-Reply-To: <20190122150543.16889-1-bala24@linux.vnet.ibm.com> References: <20190122150543.16889-1-bala24@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19012215-0020-0000-0000-00000309DFC3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19012215-0021-0000-0000-0000215B156A Message-Id: <20190122150543.16889-2-bala24@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-22_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=5 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901220118 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 1/1] migration: calculate expected_downtime considering redirtied ram 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: Juan Quintela , Balamuruhan S , dgilbert@redhat.com, peterx@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Balamuruhan S currently we calculate expected_downtime by time taken to transfer remaining ram, but during the time we had transferred remaining ram few pages of ram might be redirtied and we need to retransfer it, so it is better to consider them for calculating expected_downtime for getting more accurate values. Total ram to be transferred = remaining ram + (redirtied ram at the time when the remaining ram gets transferred) redirtied ram = dirty_pages_rate * time taken to transfer remaining ram redirtied ram = dirty_pages_rate * (remaining ram / bandwidth) expected_downtime = (remaining ram + redirtied ram) / bandwidth Suggested-by: David Gibson Suggested-by: Dr. David Alan Gilbert Signed-off-by: Balamuruhan S --- migration/migration.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index ffc4d9e556..dc38e9a380 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2903,7 +2903,13 @@ 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.remaining / bandwidth; + /* Time required to transfer remaining ram */ + remaining_ram_transfer_time = ram_counters.remaining / bandwidth + + /* redirty of ram at the time remaining ram gets transferred*/ + newly_dirtied_ram = ram_counters.dirty_pages_rate * remaining_ram_transfer_time + + s->expected_downtime = (ram_counters.remaining + newly_dirtied_ram) / bandwidth; } qemu_file_reset_rate_limit(s->to_dst_file);