From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8wZ0-0007av-0q for qemu-devel@nongnu.org; Thu, 30 Jan 2014 13:42:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8wYu-0005NG-1g for qemu-devel@nongnu.org; Thu, 30 Jan 2014 13:42:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8wYt-0005Mx-PT for qemu-devel@nongnu.org; Thu, 30 Jan 2014 13:42:03 -0500 Message-ID: <52EA9D1B.1090305@redhat.com> Date: Thu, 30 Jan 2014 20:42:35 +0200 From: Orit Wasserman MIME-Version: 1.0 References: <1391105318-23247-1-git-send-email-owasserm@redhat.com> <1391105318-23247-5-git-send-email-owasserm@redhat.com> <20140130182336.GH2655@work-vm> In-Reply-To: <20140130182336.GH2655@work-vm> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 4/6] XBZRLE cache size should not be larger than guest memory size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, anthony@codemonkey.ws, quintela@redhat.com On 01/30/2014 08:23 PM, Dr. David Alan Gilbert wrote: > * Orit Wasserman (owasserm@redhat.com) wrote: >> Signed-off-by: Orit Wasserman >> --- >> migration.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/migration.c b/migration.c >> index 46a7305..25add6f 100644 >> --- a/migration.c >> +++ b/migration.c >> @@ -479,6 +479,13 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp) >> return; >> } >> >> + /* Cache should not be larger than guest ram size */ > > Why? (It's admittedly odd, but does it actually break something if it's larger?) > Because how XBZRLE works, the idea is that for workload that changes the same pages frequently, we can reduce the amount of transferred data sent by sending only the diff. We also compress the diff itself. The cache is used to store the previous page so we can calculate the diff, so at most it will contain all the guest pages. Orit > Dave > >> + if (value > ram_bytes_total()) { >> + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", >> + "exceeds guest ram size "); >> + return; >> + } >> + >> new_size = xbzrle_cache_resize(value); >> if (new_size < 0) { >> error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size", >> -- >> 1.8.3.1 >> > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK >