Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2759563ybi; Thu, 18 Jul 2019 13:55:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvNRxZhI6qy0LtIe/ROj7Jnq/sqza0Bfsllq09iEwIm+rrXYzedH3Z+wfXz/7KdFbxjBXF X-Received: by 2002:a63:4f51:: with SMTP id p17mr26263403pgl.333.1563483304204; Thu, 18 Jul 2019 13:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563483304; cv=none; d=google.com; s=arc-20160816; b=tK939JsjhFkKnUZmQg/ZVV/83lK3/GvdRcwIj8/hFVequC5bccAbkV06XliiHrChXl 8ncz/5747Xy9DtA/HThADtEMIh6NMJBvPD3jYKvErudQiV7PoGEy0yTF3uHFNgfAQfnL 9G9QaJZBXIc+ov1qCJcAPQG0ZI7Jsq5ODlZGjHXXfyq2zbq9kRc3Syy4b6lEQnSLwImx oVmuRq9utheLU0AGDBSfHM2rmXGFG7xcVMW2oX1ZsqH3ihYNZAKkiezKPpw+IPk5NhNR tHOSuNlMOeC8pBK4ch2IXXYw/w+ORLiGqocjxs+g1ddGA4X1QzbfKvBBUdlJlUV9M4y8 rang== 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=7emRYoT5fb8r2z6gXsWHsiNYUTpTl/PouMaFyVOjnww=; b=fUFl5iwP0e7AlimC0v1Lm2hmgDIBFWl9Jwav8sg5RDaOhFwHP910V/gv/RAsFCXycd RkunAIRY5l+StVm3jMyaceE66UtU0FDId2LRGViRRPFFJ1pIBLmTuS6eaRMAZE4o6+68 yJDLqJhsUsnk56K2+zbIaS9y0znHAQkdKqw7I8Rgmf/pswSabryfinTlQ9NIcXfyOaJR ahv8o91UpOPZgKzY+nERz2HCaifjzlsAIWK7v4LwLfzuNUZ+LLYUIK9jEGoQ8ize5yRz Jm/cVFXwTLyhtBL418OPCo57D4NfGCWw+gmxJZSQRTD0751DePeDtye/guj8Y47EsR0+ TJDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UTzC65bg; 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 l125si28721703pgl.63.2019.07.18.13.54.48; Thu, 18 Jul 2019 13:55:04 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UTzC65bg; 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 S2391004AbfGRUy2 (ORCPT + 99 others); Thu, 18 Jul 2019 16:54:28 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46144 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728014AbfGRUy1 (ORCPT ); Thu, 18 Jul 2019 16:54:27 -0400 Received: by mail-qk1-f194.google.com with SMTP id r4so21552639qkm.13; Thu, 18 Jul 2019 13:54:27 -0700 (PDT) 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=7emRYoT5fb8r2z6gXsWHsiNYUTpTl/PouMaFyVOjnww=; b=UTzC65bgSmS0ZVhgdWSoC3T5DMUpzjrxwzvNfIMglsBH1bv2RR184lr6xU7FEpxEwW rGcf8KKjlzepDJvuwOk+V7PacziM1Wa46b0Mda1ESFrVemjZtCu3R+3xko8BvfDtYqlg NsDu1s5waBUWJQIa+G4+mxanK2mzuA1uLYeDJ0YmKMpRgfFIDKYzNcRSMbNdAPxdNVly NAMdVsTdSkjj0OK4oeOSEVmTagAyQ0jo8t/q6CXLUvBEVqDWnX1rqmORNv6VJpEhAiIj sf1FZZBwqUMSvo1ik1WbhMkklOPSy7WXWxxCMV3zSbp8gHG/NRQDvDwKM51n95pq/Bvk h9jw== 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=7emRYoT5fb8r2z6gXsWHsiNYUTpTl/PouMaFyVOjnww=; b=Tz7X3mz7MFPYGv6qr0C5kxt3yOcXtDwqhE2XB5FNjzXGgwIshtPIkvUXfmCiWB0EsQ hFE1DJK4gPWPba2DO44YWnx5lA8Ud1MgQ/vwW7zDjv4CbSRtZU9F/WjwuZRQMMkmHtgp DNvjpxoFY9SAN8ZKF0loAdwt4UiOB0FuFD8XX8c5zyFiWLC9S4dSJH/Jys/mOeRhXV79 BCRD6AU5es44SPZvSagkmUurknqeA9I8THdMJTQ/7/pSU+VYxU5kCjxD40xNLpcvKTFh hHAfXnSvywWwf4gEFQNFRuWvE8GPnKaw5FLwp3y0WEt5t7yla/9ccbfz05PyiLP60ObN 4Obw== X-Gm-Message-State: APjAAAUBGrCS9Ggj8xtaFaFym1bo8CARZe1JEFuYv/kgOvQFg8OrG6QZ sjDU9tJsYgOU6CZZd/yAWzjLMbKpJvxBt6SH1sE= X-Received: by 2002:a37:7ec1:: with SMTP id z184mr32664238qkc.491.1563483266795; Thu, 18 Jul 2019 13:54:26 -0700 (PDT) MIME-Version: 1.0 References: <20190716115535-mutt-send-email-mst@kernel.org> <20190716125845-mutt-send-email-mst@kernel.org> <20190717055804-mutt-send-email-mst@kernel.org> <20190718003211-mutt-send-email-mst@kernel.org> <20190718113548-mutt-send-email-mst@kernel.org> <20190718163325-mutt-send-email-mst@kernel.org> In-Reply-To: <20190718163325-mutt-send-email-mst@kernel.org> From: Alexander Duyck Date: Thu, 18 Jul 2019 13:54:15 -0700 Message-ID: Subject: Re: [PATCH v1 6/6] virtio-balloon: Add support for aerating memory via hinting To: "Michael S. Tsirkin" Cc: Nitesh Narayan Lal , kvm list , David Hildenbrand , Dave Hansen , LKML , linux-mm , Andrew Morton , Yang Zhang , pagupta@redhat.com, Rik van Riel , Konrad Rzeszutek Wilk , lcapitulino@redhat.com, wei.w.wang@intel.com, Andrea Arcangeli , Paolo Bonzini , dan.j.williams@intel.com, Alexander Duyck 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 Thu, Jul 18, 2019 at 1:37 PM Michael S. Tsirkin wrote: > > On Thu, Jul 18, 2019 at 01:29:14PM -0700, Alexander Duyck wrote: > > So one thing that is still an issue then is that my approach would > > only work on the first migration. The problem is the logic I have > > implemented assumes that once we have hinted on a page we don't need > > to do it again. However in order to support migration you would need > > to reset the hinting entirely and start over again after doing a > > migration. > > Well with precopy at least it's simple: just clear the > dirty bit, it won't be sent, and then on destination > you get a zero page and later COW on first write. > Right? Are you talking about adding MADV_DONTNEED functionality to FREE_PAGE_HINTS? > With precopy it is tricker as destination waits until it gets > all of memory. I think we could use some trick to > make source pretend it's a zero page, that is cheap to send. So I am confused again. What I was getting at is that if I am not mistaken block->bmap is set to all 1s for each page in ram_list_init_bitmaps(). After that the precopy starts and begins moving memory over. We need to be able to go in and hint away all the free pages from that initial bitmap. To do that we would need to have the "Hinted" flag I added in the patch set cleared for all pages, and then go through all free memory and start over in order to hint on which pages are actually free. Otherwise all we are doing is hinting on which pages have been freed since the last round of hints. Essentially this is another case where being incremental is problematic for this design. What I would need to do is reset the "Hinted" flag in all of the free pages after the migration has been completed.