Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2743515ybi; Thu, 18 Jul 2019 13:35:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzo4Kxh4mHnyZEEDkSqoDgx5j9gY09KXJcjQ6EivRfiN0S+5ZLqeXq1PNeZeIlOMCVyuSWg X-Received: by 2002:a65:62c4:: with SMTP id m4mr48524837pgv.243.1563482100854; Thu, 18 Jul 2019 13:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563482100; cv=none; d=google.com; s=arc-20160816; b=oYMBP2bCOu2A+Ml7zfRDPPj/NSQSow5fxf+VK8/X7a0T2P5P/QkP/h+ZTblJeRVFIN siG4eXgT+zQLeGKO1sjAoZNHJdTW/BgJTce3xItRkrJ8KXQRdIcdRoiTH5qTVJam1Z51 VguTSmqzMy2OAwcC6RgzNJ77LruXOp9t0Fz+vzFHf7CV2VKblpeVRsDUhjXh3M1XixUU o8go8pMWAX/MRHiAs7JIOrKzw/XW03BByk063e7qv6+/a96PQswB2K2gnTofGLu/K+x6 5snKtptx4nJJjmbHMqA02GfR3WI99LvroPJs7MvGAg/ohADfcXP8ZhDiA9BmqoWIWbXu uIeQ== 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=lUeG90JN23owse4hkCx6s3PvuPmRRtzpsafpqQdcTUA=; b=v2K17AuaMrtoZ7cJUlfGmVssn7eLZMgrE0DVt7gYzp67slJs+vegjYZNRnQFkhyMdJ h2qwCGSQ3MskPrTQvbMPU2XMJxnU81qiYsrU+99XBNhccQQP/9TLrF4l+lkIEqjEXhGF 637iiptm9KF/aYSMUyrUV3tDcc/CziH3lFS0wVhr4ZaPnq2wLWKwy4v4AYCu0RaaojyR ZYJzqPmPcyFWslm7v4OQm5DCFJ3Evj2mCjabDbrLR9czt0qBw6r4G1S5+aDAEf3HBFVf YDbXfn7p0Ry+DgzfdbWMi+tf/7DfTxpGldkG9OW0Et3Nv3M6noJ9LP61JcUDRoqcwe9P YA6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QrW2+V7X; 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 w2si1172634pjn.29.2019.07.18.13.34.44; Thu, 18 Jul 2019 13:35:00 -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=QrW2+V7X; 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 S2391558AbfGRUeQ (ORCPT + 99 others); Thu, 18 Jul 2019 16:34:16 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:35552 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727687AbfGRUeQ (ORCPT ); Thu, 18 Jul 2019 16:34:16 -0400 Received: by mail-qk1-f194.google.com with SMTP id r21so21607478qke.2; Thu, 18 Jul 2019 13:34:15 -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=lUeG90JN23owse4hkCx6s3PvuPmRRtzpsafpqQdcTUA=; b=QrW2+V7Xl/KTpbKakLlvwVZhX3mvxwY8oW2vB8V+YuPlRdScITuH23acCo57C3rm+/ h14/iR5ajTzevvTZgDQqOGErulK0PjguBwTAsH9Y3EKi7j2DqAkinW13yKCiWiMvwlhz G337M9FxyP8xW3prNI+Y46tV6LKGfIKoJnpWP/StoXaJ8VaE6k8S6GraWUdl1DQ0jPVo 5Nzq45cBYGbC8mYGBvPk+lRY+CeB7ljQ0M/WcypXEL0YLyup+trYqw1VrHc7N+XihAnT qSr15Qriyhre6ikVXcxStPhA9GKq5L81kUbOPa4ctMEOcvvh0wTxrAiF0q1LX9t8rDOw pMUg== 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=lUeG90JN23owse4hkCx6s3PvuPmRRtzpsafpqQdcTUA=; b=tV6AzQ70CZ50bIq9WkIk8mYzhWZnE43IifEmj1tFpm0upBP1EYn3XXh68o+Kv/gTH7 rV3kE6Cf6f+45UPdPM5yE2lLcWq5QnSnwtQ6EWfOO9yGNcQk/q8l/+lPGfSofhZwjTSM wB7H4udHyzDZJGfpj/MOZHL6O5V+Xk5oUmVWzzyL+PEvlm2stJV7XbCjn+iJ8M9oa5g9 r9MEIh7qWvc/O09UmJGa48ksNCLYnnjp83KVpZUqJ7rwOZmu/uY3BTWQvgEivKE3l1Ia sinDbQURHHwgs6x673X9h8+CCC15IpOYDQGtjwR6beBYOKfgDQriNjVVsdmPCbztC7/E qYCw== X-Gm-Message-State: APjAAAXGYLlAm+58JuDOP8Wdlm/SjefGYl5/R2l0pnviuR4AWgYDvUI8 WQd0NjFxf88hHk7kjLRMJG/6LwimFx1+PyJcqwGTpQ== X-Received: by 2002:a37:9042:: with SMTP id s63mr31248155qkd.344.1563482055130; Thu, 18 Jul 2019 13:34:15 -0700 (PDT) MIME-Version: 1.0 References: <20190716055017-mutt-send-email-mst@kernel.org> <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> <20190718162040-mutt-send-email-mst@kernel.org> In-Reply-To: <20190718162040-mutt-send-email-mst@kernel.org> From: Alexander Duyck Date: Thu, 18 Jul 2019 13:34:03 -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:24 PM Michael S. Tsirkin wrote: > > On Thu, Jul 18, 2019 at 08:34:37AM -0700, Alexander Duyck wrote: > > > > > For example we allocate pages until shrinker kicks in. > > > > > Fair enough but in fact many it would be better to > > > > > do the reverse: trigger shrinker and then send as many > > > > > free pages as we can to host. > > > > > > > > I'm not sure I understand this last part. > > > > > > Oh basically what I am saying is this: one of the reasons to use page > > > hinting is when host is short on memory. In that case, why don't we use > > > shrinker to ask kernel drivers to free up memory? Any memory freed could > > > then be reported to host. > > > > Didn't the balloon driver already have a feature like that where it > > could start shrinking memory if the host was under memory pressure? If > > so how would adding another one add much value. > > Well fundamentally the basic balloon inflate kind of does this, yes :) > > The difference with what I am suggesting is that balloon inflate tries > to aggressively achieve a specific goal of freed memory. We could have a > weaker "free as much as you can" that is still stronger than free page > hint which as you point out below does not try to free at all, just > hints what is already free. Yes, but why wait until the host is low on memory? With my implementation we can perform the hints in the background for a low cost already. So why should we wait to free up memory when we could do it immediately. Why let things get to the state where the host is under memory pressure when the guests can be proactively freeing up the pages and improving performance as a result be reducing swap usage?