Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1125691imj; Sat, 9 Feb 2019 16:39:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IZsL/pVTk15znzq73fKUwRY7DMZnL+qoAkDjuFT53YkxzGta8wrXeHhGQZhZj+nD2auo91T X-Received: by 2002:a65:6099:: with SMTP id t25mr27164116pgu.448.1549759172533; Sat, 09 Feb 2019 16:39:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549759172; cv=none; d=google.com; s=arc-20160816; b=XinjCAtx7w5embza5NiWZK4ussrXFvrpeuGMmA4eVak1eyHUlwDFRpd1GmsRyKX8qi 6ctk17V2F6wQCMG9WP31KzEn+hAAMYUsE1QBoa1eNFFtjN7RIdm2oThw9LJMENsT5A1/ Cv+dwwYQ97ddhssRIpKLDsocvzWshbFK79Q7E9cwkfK28U12XC3ddjdKAqMBqYrZrgdp S72J7bGS1eOWhnczDv9QHFgsLPyQlVzleR+snUPKr6Pd7l/UCznyrAr29pbQ1Gy360v0 z+vS+fHIpFdM8vUra+dSWu15WWIoC84YtrFUEZuMvrF+u30OmA5kL95ldFWJcSkifvv0 uYFg== 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:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=e6pt6kjIbglC64cZC4M0oP0E6itDrEv52AswOm0vRac=; b=J/HqQCGnarWPP3ruUvERQ8LGQsrNdcoG5yRMFnvQ+ovrN4q+C1/PHlYarvQWW33RIn qRaN6D+G8zV4KIhUzdxCkPGyYlI4qhveCuB+O9oofN/LjotyRaUb6AKsV8KV1zWQnD1/ tZPTDm6Vd87RR3qCP/UyDeojLTcqIdgrTY8HsO9pFbhE/SIvkE8IObYiazvSdmReoque NYHVZGUUKGtRVHPhWfTRK6QlCjnMxquu9lc/cNUvPYqEtpkUs9dlVdguTLYHm4rT53qG E81INRdZk8JXU8bKVbMTc7jMCiuqPYA9tmOCrZSNSshfoIcdf3cu7ZXHe3CoWJnhx4Cf 6/tA== 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 e125si5944530pgc.411.2019.02.09.16.39.00; Sat, 09 Feb 2019 16:39:32 -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 S1727036AbfBJAi5 (ORCPT + 99 others); Sat, 9 Feb 2019 19:38:57 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:44451 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726940AbfBJAi4 (ORCPT ); Sat, 9 Feb 2019 19:38:56 -0500 Received: by mail-qt1-f196.google.com with SMTP id n32so8287962qte.11 for ; Sat, 09 Feb 2019 16:38:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=e6pt6kjIbglC64cZC4M0oP0E6itDrEv52AswOm0vRac=; b=Q9JnbWedP8tP2Kt/SnktfKq3scPacDyG5i8u/jmZ1Sxb9OCr8afB2FH8x5vE1RQQqA OYPUgkEglcpadKe0RVnB+sqA7JPeloyiaCM3EwoXjRuVpyDjq9Uxev73ilR+Nzfhj8sB oZcvkaA073RpiERma0bI7XrUOzi/XB0y+rStNXL2jpOG55Q8GpYuwz0+uzM/bKif1qmO CzBau4IcfxbsiAKymEI9TdqNj66CG/oN64/OBaTo7u1QEnApHTWCKgN5KpXEbziiO3UW rtlEEc84w2/mEVxibeboB+rz65g5RV0db33z/uCj2mD66/paIqRa41HJZxCxjB+qfMpy lNeA== X-Gm-Message-State: AHQUAuYJ7AV/Ey0RW6Y/LEVQRVwppXrksnIur/OYuLxIpPUih9H0tJzF qcH2kMrYTO1XIm+8OrxHK60Ebw== X-Received: by 2002:ac8:3855:: with SMTP id r21mr14649385qtb.91.1549759135614; Sat, 09 Feb 2019 16:38:55 -0800 (PST) Received: from redhat.com (pool-173-76-246-42.bstnma.fios.verizon.net. [173.76.246.42]) by smtp.gmail.com with ESMTPSA id k66sm6398236qkc.25.2019.02.09.16.38.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Feb 2019 16:38:54 -0800 (PST) Date: Sat, 9 Feb 2019 19:38:51 -0500 From: "Michael S. Tsirkin" To: Alexander Duyck Cc: Nitesh Narayan Lal , 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 Subject: Re: [RFC][Patch v8 6/7] KVM: Enables the kernel to isolate and report free pages Message-ID: <20190209192104-mutt-send-email-mst@kernel.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 wrote: > > > > 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 test 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 for > > > > 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? > 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. -- MST