Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4088426imj; Tue, 12 Feb 2019 09:34:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IYmlcWHUMTpLq51eJYqf1lGz+ZYlTtDN67ZT+JIz0ObC4klJSdYFDwDK0lXWb08kf52YTaz X-Received: by 2002:a62:1981:: with SMTP id 123mr1186882pfz.69.1549992843579; Tue, 12 Feb 2019 09:34:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549992843; cv=none; d=google.com; s=arc-20160816; b=FLg24LSK53yF1WburxPtinYRTajakewi9JUFvY76r9/ujshkWyKpB1LJEkgLhBe4SL gwInqrTv4C8LMdVQtZrimBa8tsn+wiZFrvTYM0GoT3UzIyBr5YQTrRiKYVICdfMIACGk jX0gngvbB3DhmPWPwWwaesjlJ/X8CANqGcP91tcexCCIOxnsi9sdP86PrBFAnnTvfYRq wTKSSrHKUzo7YivV5NKmJ587F8a84c7KpUcAI9PucUMUU1f8ddwrTUVHPj/HDZyINvts SGRiOguoh3hoW6aKsfn4SW3EF77f/O+nFllSRBqGUAjZTJsewcRAz7UA0rODjOssaS1S 5TEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:cc:to :subject; bh=pfkwPM1JfeoRTZbfnzDDX9oI3cwwuL5z50t/y/yMOw8=; b=L4ITEhkzPmk4TJnJtJt2cAt+f2yeLYU4FJf/UCul3hKFctD+WlrgrnvWmJBeU8gdLg niDJ8zSyEiOKVi8x3vHPK5GallinCi74JGJ+j836RYsLCtMz9cuS4sC4JXrOSZHN0BjF 2i8+lD+J8kli074G2T0xXTxgXfatT3K93JDDFijaYvvJEGdrkosKUUJs4rEusT6B5mOg XYKtTRnUzNPrqZIEvlCkJjs71FP9OPy3Ni34n6iDjvzrtfQ4JtPanga7uG9K8brjGsn0 +qAkDW7nPh8GAQGVYNv9qD9a8pYrPlLPev31MjuHMvU/XO6oMcpJkNq27R1+bmGXzxAp RERw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si12774506pgf.453.2019.02.12.09.33.47; Tue, 12 Feb 2019 09:34:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731339AbfBLRK5 (ORCPT + 99 others); Tue, 12 Feb 2019 12:10:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53836 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729662AbfBLRK4 (ORCPT ); Tue, 12 Feb 2019 12:10:56 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8BDC6696E; Tue, 12 Feb 2019 17:10:55 +0000 (UTC) Received: from [10.18.17.32] (dhcp-17-32.bos.redhat.com [10.18.17.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC3BF62667; Tue, 12 Feb 2019 17:10:53 +0000 (UTC) Subject: Re: [RFC][Patch v8 6/7] KVM: Enables the kernel to isolate and report free pages To: "Michael S. Tsirkin" , Alexander Duyck Cc: kvm list , LKML , Paolo Bonzini , lcapitulino@redhat.com, pagupta@redhat.com, wei.w.wang@intel.com, Yang Zhang , Rik van Riel , david@redhat.com, dodgen@google.com, Konrad Rzeszutek Wilk , dhildenb@redhat.com, Andrea Arcangeli References: <20190204201854.2328-7-nitesh@redhat.com> <20190205153607-mutt-send-email-mst@kernel.org> <20190205165514-mutt-send-email-mst@kernel.org> <20190208163601-mutt-send-email-mst@kernel.org> <20190209192104-mutt-send-email-mst@kernel.org> From: Nitesh Narayan Lal Openpgp: preference=signencrypt Autocrypt: addr=nitesh@redhat.com; prefer-encrypt=mutual; keydata= mQINBFl4pQoBEADT/nXR2JOfsCjDgYmE2qonSGjkM1g8S6p9UWD+bf7YEAYYYzZsLtbilFTe z4nL4AV6VJmC7dBIlTi3Mj2eymD/2dkKP6UXlliWkq67feVg1KG+4UIp89lFW7v5Y8Muw3Fm uQbFvxyhN8n3tmhRe+ScWsndSBDxYOZgkbCSIfNPdZrHcnOLfA7xMJZeRCjqUpwhIjxQdFA7 n0s0KZ2cHIsemtBM8b2WXSQG9CjqAJHVkDhrBWKThDRF7k80oiJdEQlTEiVhaEDURXq+2XmG jpCnvRQDb28EJSsQlNEAzwzHMeplddfB0vCg9fRk/kOBMDBtGsTvNT9OYUZD+7jaf0gvBvBB lbKmmMMX7uJB+ejY7bnw6ePNrVPErWyfHzR5WYrIFUtgoR3LigKnw5apzc7UIV9G8uiIcZEn C+QJCK43jgnkPcSmwVPztcrkbC84g1K5v2Dxh9amXKLBA1/i+CAY8JWMTepsFohIFMXNLj+B RJoOcR4HGYXZ6CAJa3Glu3mCmYqHTOKwezJTAvmsCLd3W7WxOGF8BbBjVaPjcZfavOvkin0u DaFvhAmrzN6lL0msY17JCZo046z8oAqkyvEflFbC0S1R/POzehKrzQ1RFRD3/YzzlhmIowkM BpTqNBeHEzQAlIhQuyu1ugmQtfsYYq6FPmWMRfFPes/4JUU/PQARAQABtCVOaXRlc2ggTmFy YXlhbiBM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ZV7aT37sC+Rp0o3KNc+GXTR+GSVq87Xfuhx0LRST NK9ZhT0+qkiN7npFLtNtbzwqaqceq3XhafmCiw8xrtzCnlB/C4SiBr/93Ip4kihXJ0EuHSLn VujM7c/b4pps Organization: Red Hat Inc, Message-ID: <941fc3c3-e38d-a744-5d4a-94a63c6ad62e@redhat.com> Date: Tue, 12 Feb 2019 12:10:52 -0500 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: <20190209192104-mutt-send-email-mst@kernel.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7J8ManGoh82i3G7TWYecVQdqYvIjZDxYF" X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Feb 2019 17:10:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7J8ManGoh82i3G7TWYecVQdqYvIjZDxYF Content-Type: multipart/mixed; boundary="LGoU5OqJvrWR8z2fPxS0Q9CW28nUTKijU"; protected-headers="v1" From: Nitesh Narayan Lal To: "Michael S. Tsirkin" , Alexander Duyck Cc: kvm list , LKML , Paolo Bonzini , lcapitulino@redhat.com, pagupta@redhat.com, wei.w.wang@intel.com, Yang Zhang , Rik van Riel , david@redhat.com, dodgen@google.com, Konrad Rzeszutek Wilk , dhildenb@redhat.com, Andrea Arcangeli Message-ID: <941fc3c3-e38d-a744-5d4a-94a63c6ad62e@redhat.com> Subject: Re: [RFC][Patch v8 6/7] KVM: Enables the kernel to isolate and report free pages References: <20190204201854.2328-7-nitesh@redhat.com> <20190205153607-mutt-send-email-mst@kernel.org> <20190205165514-mutt-send-email-mst@kernel.org> <20190208163601-mutt-send-email-mst@kernel.org> <20190209192104-mutt-send-email-mst@kernel.org> In-Reply-To: <20190209192104-mutt-send-email-mst@kernel.org> --LGoU5OqJvrWR8z2fPxS0Q9CW28nUTKijU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US On 2/9/19 7:38 PM, Michael S. Tsirkin wrote: > On Fri, Feb 08, 2019 at 02:05:09PM -0800, Alexander Duyck wrote: >> On Fri, Feb 8, 2019 at 1:38 PM Michael S. Tsirkin wro= te: >>> On Fri, Feb 08, 2019 at 03:41:55PM -0500, Nitesh Narayan Lal wrote: >>>>>> I am also planning to try Michael's suggestion of using MAX_ORDER = - 1. >>>>>> However I am still thinking about a workload which I can use to te= st its >>>>>> effectiveness. >>>>> You might want to look at doing something like min(MAX_ORDER - 1, >>>>> HUGETLB_PAGE_ORDER). I know for x86 a 2MB page is the upper limit f= or >>>>> THP which is the most likely to be used page size with the guest. >>>> Sure, thanks for the suggestion. >>> Given current hinting in balloon is MAX_ORDER I'd say >>> share code. If you feel a need to adjust down the road, >>> adjust both of them with actual testing showing gains. >> Actually I'm left kind of wondering why we are even going through >> virtio-balloon for this? > Just look at what does it do. > > It improves memory overcommit if guests are cooperative, and it does > this by giving the hypervisor addresses of pages which it can discard. > > It's just *exactly* like the balloon with all the same limitations. > >> It seems like this would make much more sense >> as core functionality of KVM itself for the specific architectures >> rather than some side thing. > Well same as balloon: whether it's useful to you at all > would very much depend on your workloads. > > This kind of cooperative functionality is good for co-located > single-tenant VMs. That's pretty niche. The core things in KVM > generally don't trust guests. > > >> In addition this could end up being >> redundant when you start getting into either the s390 or PowerPC >> architectures as they already have means of providing unused page >> hints. > Interesting. Is there host support in kvm? > > >> I have a set of patches I proposed that add similar functionality via >> a KVM hypercall for x86 instead of doing it as a part of a Virtio >> device[1]. I'm suspecting the overhead of doing things this way is >> much less then having to make multiple madvise system calls from QEMU >> back into the kernel. > Well whether it's a virtio device is orthogonal to whether it's an > madvise call, right? You can build vhost-pagehint and that can > handle requests in a VQ within balloon and do it > within host kernel directly. > > virtio rings let you pass multiple pages so it's really hard to > say which will win outright - maybe it's more important > to coalesce exits. > > Nitesh, how about trying same tests and reporting performance? Noted, I can give it a try before my next positing. > > >> One other concern that has been pointed out with my patchset that >> would likely need to be addressed here as well is what do we do about >> other hypervisors that decide to implement page hinting. We probably >> should look at making this KVM/QEMU specific code run through the >> paravirtual infrastructure instead of trying into the x86 arch code >> directly. >> >> [1] https://lkml.org/lkml/2019/2/4/903 > > So virtio is a paravirtual interface, that's an argument for > using it then. > > In any case pls copy the Cc'd crowd on future version of your patches. > --=20 Regards Nitesh --LGoU5OqJvrWR8z2fPxS0Q9CW28nUTKijU-- --7J8ManGoh82i3G7TWYecVQdqYvIjZDxYF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkXcoRVGaqvbHPuAGo4ZA3AYyozkFAlxi/hwACgkQo4ZA3AYy ozm79g//UvTPI4aVhIteaZHs3qkezYTAZa/qjveQePvFwZwxnL2zPu28xPUOU0E1 rsobZJYN8xSLDqRdje2p3eJZHx03ChNT9cRO3XhMWRdHLqnBQ7gt0SJFPd+qWEf+ YpLUjlWVC4kepIeEKlaPvFlGQ8sXDdc9OX6aTrIccmXsD2F7wOYVldlAT5qoZ+K9 lzKugk3gAesdlTJSAoGy2aaQ3MEAFCpqGgDpmHIOU2za9AAPLL3PUBpwC5PVtPtb wgMc5yYebCWxDTICWupYjcw+yceNkF0Es829r5ivPwk1DKEMrPK98piv9+8jjvWj XgflFyfrHiU1tUpdhLkmLk+bZIkhxigHwAUBNY6Kdh6OAN11kgBQgsDh0FSDbXcC l/EMrv2Pnktw9VfcsoABO43Y42FHZN8qLkKmq+re4YwkHy2QgVilBR2uNbSzDNrM J1xig2TTMs652QED4DLa/+7r71ceoP9WImtWuH8OGSkZan2ybInOC07fR2/QL7+m 9NUss4eSes3u95470h5jUh9D1yVrwwT6Vz8+t91XHZc7K6AfGEezo653A6ekH6pl ZvHa0WJ0ZBNkZnEFH/G68Yegm3/ZO9Wph6v+O9lWKjTD1uNL3GFZU/1+Je6XtMHJ 3PXiummtTXTgPpZdO7VOCFhLJGeTug7T9GTVSCf6wYhaMaquEqE= =E0SH -----END PGP SIGNATURE----- --7J8ManGoh82i3G7TWYecVQdqYvIjZDxYF--