Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10638945ybi; Thu, 25 Jul 2019 02:53:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuF0enaVzm36TQ40sgeoOKpeHzUVFlp7FB2sPWteLW/TiPHvgEjmuJy/kdIGKga3RSMSxf X-Received: by 2002:a17:902:4c88:: with SMTP id b8mr93189969ple.29.1564048395142; Thu, 25 Jul 2019 02:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564048395; cv=none; d=google.com; s=arc-20160816; b=FumpoE9vLSUoIp0ULDP6T736ird3lRfIjzZmV0SiijzNzNC+W7Gsa4PtrEEG2gv8Ue 155TNpzrSciLzgrwMs7djCXUrbRzb9p0xNktJmjJ0ToCiY0DXJaq1obkvl/gADcLmrfr BBBGf4fsryxZ/6f+o4s25bU6jtUnjM1vCfbdLPMFUhyI/TozdTY7VxKy6S3BKEob8Whz dFPJKI0Sa2dig6We3+uRdNECyK+VwNk92ma5dnIrhaMe6J4yewQoWtRcga1m5hiFrhnC L8DISn6nfKslpHV/gxnAAaUwjBYjQNO47lNc1K43g7EDPtblEGq2xr6tToefS5kADAhj tA5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=Vt84thAsLWJyAd5XrtQr8ILHkY6FV6XP1tRY7DSDNVE=; b=TxfMENnLP4ATstnBaFDtCA/aYBB2XXNdG42F5cxwvZE4f+a50VeefjK8KR2BbGAVQA PJ+osiHeLrlr2CAWAX3Rn4SQLuBKYf0WSiAmb4q4tq+89ZmloZKiPoGj0mXUMxIn2IPx cTTIuQH6ALU7KLonuW+Y03ry+bBqj6t8vVp+xA+r/3BPiJNGgZQ7ZOE/6jimNKTTy/+c oR5AVkOofzZFORAZQ5qBal8AMx5mZat3vDU/cYfb3VTMaxihZcpQohIpaJs/3wJAUgmg Hi02HIg4U5m1/K9eL28fk9Cu4TX5+lfU5WtiT7atXC4ZB88pbX3YBXRqGwACKSxR8efC Szgw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 186si17898953pgc.248.2019.07.25.02.52.56; Thu, 25 Jul 2019 02:53:15 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387445AbfGXWD5 (ORCPT + 99 others); Wed, 24 Jul 2019 18:03:57 -0400 Received: from mga01.intel.com ([192.55.52.88]:50964 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbfGXWD5 (ORCPT ); Wed, 24 Jul 2019 18:03:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2019 15:03:56 -0700 X-IronPort-AV: E=Sophos;i="5.64,304,1559545200"; d="scan'208";a="175019406" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2019 15:03:56 -0700 Message-ID: Subject: Re: [PATCH v2 QEMU] virtio-balloon: Provide a interface for "bubble hinting" From: Alexander Duyck To: "Michael S. Tsirkin" , Alexander Duyck Cc: nitesh@redhat.com, kvm@vger.kernel.org, david@redhat.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, yang.zhang.wz@gmail.com, pagupta@redhat.com, riel@surriel.com, konrad.wilk@oracle.com, lcapitulino@redhat.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com Date: Wed, 24 Jul 2019 15:03:56 -0700 In-Reply-To: <20190724173403-mutt-send-email-mst@kernel.org> References: <20190724165158.6685.87228.stgit@localhost.localdomain> <20190724171050.7888.62199.stgit@localhost.localdomain> <20190724173403-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-07-24 at 17:38 -0400, Michael S. Tsirkin wrote: > On Wed, Jul 24, 2019 at 10:12:10AM -0700, Alexander Duyck wrote: > > From: Alexander Duyck > > > > Add support for what I am referring to as "bubble hinting". Basically the > > idea is to function very similar to how the balloon works in that we > > basically end up madvising the page as not being used. However we don't > > really need to bother with any deflate type logic since the page will be > > faulted back into the guest when it is read or written to. > > > > This is meant to be a simplification of the existing balloon interface > > to use for providing hints to what memory needs to be freed. I am assuming > > this is safe to do as the deflate logic does not actually appear to do very > > much other than tracking what subpages have been released and which ones > > haven't. > > > > Signed-off-by: Alexander Duyck > > BTW I wonder about migration here. When we migrate we lose all hints > right? Well destination could be smarter, detect that page is full of > 0s and just map a zero page. Then we don't need a hint as such - but I > don't think it's done like that ATM. I was wondering about that a bit myself. If you migrate with a balloon active what currently happens with the pages in the balloon? Do you actually migrate them, or do you ignore them and just assume a zero page? I'm just reusing the ram_block_discard_range logic that was being used for the balloon inflation so I would assume the behavior would be the same. > I also wonder about interaction with deflate. ATM deflate will add > pages to the free list, then balloon will come right back and report > them as free. I don't know how likely it is that somebody who is getting the free page reporting is likely to want to also use the balloon to take up memory. However hinting on a page that came out of deflate might make sense when you consider that the balloon operates on 4K pages and the hints are on 2M pages. You are likely going to lose track of it all anyway as you have to work to merge the 4K pages up to the higher order page.