Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp18835imj; Fri, 8 Feb 2019 14:06:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYowvM/VwY2iM8LJHUoq8wID8fd0VydxbtTURDgEKtoWWpNgASLeag/4K7lds6ORwE6NK4N X-Received: by 2002:a63:2784:: with SMTP id n126mr22958472pgn.48.1549663566120; Fri, 08 Feb 2019 14:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549663566; cv=none; d=google.com; s=arc-20160816; b=RzUE5he6gH+lIiEfpYBjSFo2BVqDGaWZS+BYUb/FPfvEXg1o2WgUfVHNqfbwBEf9f6 0dsGa+yaQVfrPmtaWaxT7CGm0LR6HQXsgyZrcaN0RYMgK5bJHR+W4Qy+753qepoGnz2r NgIIkW5ouNpjordeAZH4nVZ7kyq9dGFy1BioVOHJxcmmHtoDi/GVEWvLF1254E3SnxHJ W41EXw6mslN/Sqss1lMyLVt6Ndvhqz2Z/RMvjw/QHcceae9QaAhs15qpTC268u0s2zCk IPsFEDbEi2jauzymvGIjl6dhDiZxAO5LP6PML683wOYypfvtMEeQyFRpLlRC5yK6Y1A5 xxkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=oMrgUPlPHD04UbzHPVNuFWqzUrtFAIYpkr+vApyx7u4=; b=0IzsTSPBl4X/SCYDV0Rzkm/9B23sJ4vj2mREHUVr1bx3n/t/eRbU3o7hIkYdn50dM6 wqWRxqNZp33DP72IijrUVb961GHvi4267hDuDwV5d2ITEwJKdXTHE/QwKxrQ9wc6hgB3 YZ6V5vMYwasvGeZBG5IEqAkqVYWz7ejDARZROIY+ogxomZAbJOihR0vQ+9aYsaEMJ5/M z3lJaFpyojl/Hc4laQ6jdA+vgEHO61GAnmtK05bE/6eQEOTqf/uJh9YD3epM3uqX8vKb 7FY01YQyCtP6EtAq1Fy1lb419PLt3Yt25Oi7BJgmSRvG2dPtvK2S1rqV2KiY/Upi2ZmZ g0kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n3PbxSIq; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si3315830plo.286.2019.02.08.14.05.45; Fri, 08 Feb 2019 14:06:06 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n3PbxSIq; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727035AbfBHWFX (ORCPT + 99 others); Fri, 8 Feb 2019 17:05:23 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:52442 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726020AbfBHWFW (ORCPT ); Fri, 8 Feb 2019 17:05:22 -0500 Received: by mail-it1-f196.google.com with SMTP id r11so7270216itc.2; Fri, 08 Feb 2019 14:05:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oMrgUPlPHD04UbzHPVNuFWqzUrtFAIYpkr+vApyx7u4=; b=n3PbxSIqDgr1mgy2PETPvv/ibiHDBnbBf44nm1U6ZfndCeSi4dPt8q2UPxC3mp9XyB cQQGJ7Wr+toACHqikkTirSm39fHeyLyxT3B6+xSr0NhUkihMUiOPAreS2lsWt3c8emcf k61jR8d2FOOwGqrXQ8NRgs5vGtgf/V0j2utexdRpQzEMSmDDAUxbw9rlrkbSZtS1hUIx p/9BeoW+VrucE/eIBM1wfFW3gp9brpXGRwiIw5N8Dp8e+emLvD0Nvh0IRQ1zdVObeNPC dJ0KOCEslh0iWuhFYPxeUJlq9j72x50AsFPxyY9vW8gDPzYtBtIIPjprW4555jmke/IJ bPOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oMrgUPlPHD04UbzHPVNuFWqzUrtFAIYpkr+vApyx7u4=; b=I8kNXSWuFIAdWPpIMxdEEPRpITOyWJULjZdwAGQ89nLCQiVBou1LZ5xXQXAiYbLtd+ Ho9xy8+chJEQ0HwtVFugN48MrRth3tXTeHRsaFKt0FWxLsevDtiaUrQY17NPI/KpnoEU 2v3zZjv1tdeI8rpgjJFUerqH1TTcWoiyTpryq3naevTfIvObuWC/um60VzP7BfUKSCjw LgdHkEtJyV9a0VPpW6PaV+X2FPbLG9Sfy18H5S3VtSbwQRCWVChDzYYKzaOCvDpDbcBg tU3KBE6R5Z5Abiws6f45izWJxMf2xhfsyHdOsNDduUhJo0xIiP2J5eJhiUwOLeNuZ4O9 h63A== X-Gm-Message-State: AHQUAubUoGfCWsZ7b3W5AfsrCd2yLH+1uMWKVVX1J5/sHiuCGUNzTZlL EhIL8q7XiQvRdedI1Y2S1LHVTYc9XKjcI3x2NSo= X-Received: by 2002:a24:5989:: with SMTP id p131mr458406itb.6.1549663521157; Fri, 08 Feb 2019 14:05:21 -0800 (PST) MIME-Version: 1.0 References: <20190204201854.2328-1-nitesh@redhat.com> <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> In-Reply-To: <20190208163601-mutt-send-email-mst@kernel.org> From: Alexander Duyck Date: Fri, 8 Feb 2019 14:05:09 -0800 Message-ID: Subject: Re: [RFC][Patch v8 6/7] KVM: Enables the kernel to isolate and report free pages To: "Michael S. Tsirkin" 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? It seems like this would make much more sense as core functionality of KVM itself for the specific architectures rather than some side thing. 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. 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. 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