From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D90C10F00 for ; Wed, 6 Mar 2019 21:41:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C684A20657 for ; Wed, 6 Mar 2019 21:41:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C684A20657 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 606B78E0003; Wed, 6 Mar 2019 16:41:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B5078E0002; Wed, 6 Mar 2019 16:41:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 457E98E0003; Wed, 6 Mar 2019 16:41:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by kanga.kvack.org (Postfix) with ESMTP id 176C18E0002 for ; Wed, 6 Mar 2019 16:41:15 -0500 (EST) Received: by mail-qt1-f199.google.com with SMTP id j22so12977624qtq.21 for ; Wed, 06 Mar 2019 13:41:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :references:from:openpgp:autocrypt:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4iWWcm7tZbJP/1wz3Z90N/s2ZY+yD+kxWSdAWkHws24=; b=W4aVeLIwZKIa4/c6xpczZuFLI49LB7N5otgk55094R7SfXn86arIgETB6VJrXXS6h5 UpHSvaaLTqyKVCndxHe9XsSiz1TWt147u1P1baJCiQD05UdR21kp1Nq3x1IZoSSCtv+9 y2UVIH9jIUYE2TgD/9wy83Je5TGQ7LfsJRlCa3Khj3tnIrzHsvb1aOPd6IphxjDLeNa5 0vAAQMMy2pdnyb/Uc0oOl6rEGegD5NRobrViuqytpiyCJS+mxvDKZ7+jnDMWhld0vNfJ huM0l5KJHO6xcZ2ZOsOwM//1WS5aiLlolsGyXLMhA+GZEcvGV0KSUH2DtO8NtquDdi7f JhkQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APjAAAUqxUwRLKh+Lx5bHJNb/khOOjWHVAyrqND3HUpy9gvqSLRFJjJW AXFDUBwhWaBlH7OowDLmnFo0DGUFkAKwIonXai+UtAhpeW70Iz//ord6lWHmUxOsc4PFTEY+kDo 1/Dyb413aPJJr3TIQZLugu5UwaNo19CXK/9DqIEssIgVRXi5txNXHOKSJlh2JjOLEUg== X-Received: by 2002:a37:f513:: with SMTP id l19mr7587364qkk.313.1551908474859; Wed, 06 Mar 2019 13:41:14 -0800 (PST) X-Google-Smtp-Source: APXvYqyTiOBvPWGdoRDjZBPp8Sn7bxS5bQfBKWrS/CpJXzOyCyH2Admig/dKdh2XxnMMroKr+Svt X-Received: by 2002:a37:f513:: with SMTP id l19mr7587321qkk.313.1551908473951; Wed, 06 Mar 2019 13:41:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551908473; cv=none; d=google.com; s=arc-20160816; b=kymsErikhbO/MnEHsmBeCNbcuaaBVBMEauYu8ouk+G25uA01zyZPxBbrm045NlZZ9r 6IYytCCPuhhmMDtqhHygd7vEtQHy0IjzCN6m/gX1kLudLBpjGM0G1qK93Wwv0tRPD22+ sku/L850srW966xDAa2GHl9teMfnwDAUNmHf4/TWdLoXsgMO/zji7/xVdwc6Eiw2No4S zTn3znVrLF74HyCQ0wVmYI3tBldS9fubRYxunItYOuU28LxtXuSYpcVj+vSbih09wEk8 ruiYAyqtHRY+aqaboocObaOYr3aphfdpl3fwsvnK2GAQbgZJ+BsEerpAD30+Cu8AKHTs UuEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:autocrypt:openpgp:from :references:cc:to:subject; bh=4iWWcm7tZbJP/1wz3Z90N/s2ZY+yD+kxWSdAWkHws24=; b=yc8CVgJzWf+Z2BdYBleNqGvT01G7zUEB1LDBvcCzDR4Y9XHTSFLB/GGxllabD3vhNk nEvLAX2I3RjkepgxT9pguEe49ncGJEMNHK9AOac2qtT8t8C5F5C/3F7kZrjZmofINMT4 KrRwsXCGN4UDXorz0I/TygkBcMvS3E8FHWRF7hkxFClu8ayE3XQza6P1Tm09MuyL3mSD SR5GNyIZbx4XRJvu4DG8a17JH0MEIR9TEeELw64+i3vGNJDrsJUE9rH8A6c07tPgr+sH HbMCjoPR/SHIyvj/1RIf+CYTTiql16mwcd/eExHEc7YeYSXwNTevYU7YXfmDO2Ugkhqu /cgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t24si1856157qta.46.2019.03.06.13.41.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 13:41:13 -0800 (PST) Received-SPF: pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE5B0307E052; Wed, 6 Mar 2019 21:41:12 +0000 (UTC) Received: from [10.36.116.78] (ovpn-116-78.ams2.redhat.com [10.36.116.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 473BF5C5FD; Wed, 6 Mar 2019 21:40:58 +0000 (UTC) Subject: Re: [RFC][Patch v9 0/6] KVM: Guest Free Page Hinting To: "Michael S. Tsirkin" Cc: Nitesh Narayan Lal , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, pbonzini@redhat.com, lcapitulino@redhat.com, pagupta@redhat.com, wei.w.wang@intel.com, yang.zhang.wz@gmail.com, riel@surriel.com, dodgen@google.com, konrad.wilk@oracle.com, dhildenb@redhat.com, aarcange@redhat.com, alexander.duyck@gmail.com References: <20190306155048.12868-1-nitesh@redhat.com> <20190306110501-mutt-send-email-mst@kernel.org> <20190306130955-mutt-send-email-mst@kernel.org> <20190306133826-mutt-send-email-mst@kernel.org> <3f87916d-8d18-013c-8988-9eb516c9cd2e@redhat.com> <20190306140917-mutt-send-email-mst@kernel.org> From: David Hildenbrand Openpgp: preference=signencrypt Autocrypt: addr=david@redhat.com; prefer-encrypt=mutual; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQa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b/iXVbM+fmSHOjEshl KMwEl/m5iLj3iHnHPVLBUWrXPdS7iQijJA/VLxjnFknhaS60hkUNWexDMxVVP/6lbOrs4bDZ NEWDMktAeqJaFtxackPszlcpRVkAs6Msn9tu8hlvB517pyUgvuD7ZS9gGOMmYwFQDyytpepo YApVV00P0u3AaE0Cj/o71STqGJKZxcVhPaZ+LR+UCBZOyKfEyq+ZN311VpOJZ1IvTExf+S/5 lqnciDtbO3I4Wq0ArLX1gs1q1XlXLaVaA3yVqeC8E7kOchDNinD3hJS4OX0e1gdsx/e6COvy qNg5aL5n0Kl4fcVqM0LdIhsubVs4eiNCa5XMSYpXmVi3HAuFyg9dN+x8thSwI836FoMASwOl C7tHsTjnSGufB+D7F7ZBT61BffNBBIm1KdMxcxqLUVXpBQHHlGkbwI+3Ye+nE6HmZH7IwLwV W+Ajl7oYF+jeKaH4DZFtgLYGLtZ1LDwKPjX7VAsa4Yx7S5+EBAaZGxK510MjIx6SGrZWBrrV TEvdV00F2MnQoeXKzD7O4WFbL55hhyGgfWTHwZ457iN9SgYi1JLPqWkZB0JRXIEtjd4JEQcx +8Umfre0Xt4713VxMygW0PnQt5aSQdMD58jHFxTk092mU+yIHj5LeYgvwSgZN4airXk5yRXl SE+xAvmumFBY Organization: Red Hat GmbH Message-ID: <9ead968e-0cc6-0061-de5c-42a3cef46339@redhat.com> Date: Wed, 6 Mar 2019 22:40:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190306140917-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 06 Mar 2019 21:41:13 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 06.03.19 21:32, Michael S. Tsirkin wrote: > On Wed, Mar 06, 2019 at 07:59:57PM +0100, David Hildenbrand wrote: >> On 06.03.19 19:43, Michael S. Tsirkin wrote: >>> On Wed, Mar 06, 2019 at 01:30:14PM -0500, Nitesh Narayan Lal wrote: >>>>>> Here are the results: >>>>>> >>>>>> Procedure: 3 Guests of size 5GB is launched on a single NUMA node with >>>>>> total memory of 15GB and no swap. In each of the guest, memhog is run >>>>>> with 5GB. Post-execution of memhog, Host memory usage is monitored by >>>>>> using Free command. >>>>>> >>>>>> Without Hinting: >>>>>>                  Time of execution    Host used memory >>>>>> Guest 1:        45 seconds            5.4 GB >>>>>> Guest 2:        45 seconds            10 GB >>>>>> Guest 3:        1  minute               15 GB >>>>>> >>>>>> With Hinting: >>>>>>                 Time of execution     Host used memory >>>>>> Guest 1:        49 seconds            2.4 GB >>>>>> Guest 2:        40 seconds            4.3 GB >>>>>> Guest 3:        50 seconds            6.3 GB >>>>> OK so no improvement. >>>> If we are looking in terms of memory we are getting back from the guest, >>>> then there is an improvement. However, if we are looking at the >>>> improvement in terms of time of execution of memhog then yes there is none. >>> >>> Yes but the way I see it you can't overcommit this unused memory >>> since guests can start using it at any time. You timed it carefully >>> such that this does not happen, but what will cause this timing on real >>> guests? >> >> Whenever you overcommit you will need backup swap. > > Right and the point of hinting is that pages can just be > discarded and not end up in swap. > > > Point is you should be able to see the gain. > > Hinting patches cost some CPU so we need to know whether > they cost too much. How much is too much? When the cost > is bigger than benefit. But we can't compare CPU cycles > to bytes. So we need to benchmark everything in terms of > cycles. > >> There is no way >> around it. It just makes the probability of you having to go to disk >> less likely. > > > Right and let's quantify this. Does this result in net gain or loss? Yes, I am totally with you. But if it is a net benefit heavily depends on the setup. E.g. what kind of storage used for the swap, how fast, is the same disk also used for other I/O ... Also, CPU is a totally different resource than I/O. While you might have plenty of CPU cycles to spare, your I/O throughput might already be limited. Same goes into the other direction. So it might not be as easy as comparing two numbers. It really depends on the setup. Well, not completely true, with 0% CPU overhead we would have a clear winner with hinting ;) > > >> If you assume that all of your guests will be using all of their memory >> all the time, you don't have to think about overcommiting memory in the >> first place. But this is not what we usually have. > > Right and swap is there to support overcommit. However it > was felt that hinting can be faster since it avoids IO > involved in swap. Feels like it, I/O is prone to be slow. -- Thanks, David / dhildenb