Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1924123imj; Sun, 17 Feb 2019 18:37:41 -0800 (PST) X-Google-Smtp-Source: AHgI3IYDuX3I5iEee9zM96qOzL/sCg6FNu87E6+ae0Cfh6kYGbIPtS1JLJd8DLRro1X9m7/CLMHM X-Received: by 2002:a63:cc12:: with SMTP id x18mr16630410pgf.33.1550457461344; Sun, 17 Feb 2019 18:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550457461; cv=none; d=google.com; s=arc-20160816; b=u39o9CGzaRb1CT8zuBOYLm922Rs23puuSFkX3d6Z4eBWOIWhkIhW9g+rH9C/wxOeGp 2Tn9yzqm6UGjn1eZR/ICgeO0oZCtdrtnVLjfdqK11IFI8DmiKm6KTNXYeg/oRiMq/0LI QKvG6CWxGP0JIpnqtc8HtECbcyHE7NgTWMws4Yw6bK4nG5aLsSF6cXTHQgpzO8/JPXcJ rMoBLQpL/zE4kYPPc5YDwDbynRcW56Fl4a2jztbrdvtL6VHIe/QVP4ifQZH+N9xYrzwS ml3lNP20UEEbx9YODQu5qh5TZ//hOmEvw7sIIhjPe+16+Im3DkMzaagZURa1srkH/e/B kOqQ== 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:in-reply-to :references:subject:to:mime-version:user-agent:from:date:message-id; bh=cYe2A2l8836qSpN33pdBuhSUHrgl/H7W7gNegXQCQ3g=; b=0VFomf5W0XodbI+eA1LYDA5EE8+qLAuFJikCXAPdxQGZ0CGSG+2x9JG/JeNQJV4cs1 lntFOELoMI/vUpL/hZG+jFLm79ydX1rLyl++b8LJOBQuuWzOwxXjpkNybUJSXI69WkCy LMD5Lu4qQiYFzNpJNdOz5JnauLtEd6e++FhYlK0EeiPBcVdIN/VaK9Vja6HLonpT3Nfw 7/+8MLafRAt5AzJ38J+EmJN/Re3sCX+nf0FZMF+Y5rsVAdk5O1wD8Ps6zHX3mtfiJtRF MbJrC2nMYZZ6GRNquhg11JWKTXMZJHE9cUgQzrgythagOVSOHCGjBEsP8Fi9Hp3gXWec W1bA== 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 q2si11797319pgh.87.2019.02.17.18.37.24; Sun, 17 Feb 2019 18:37:41 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728301AbfBRCb3 (ORCPT + 99 others); Sun, 17 Feb 2019 21:31:29 -0500 Received: from mga18.intel.com ([134.134.136.126]:23874 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727266AbfBRCb2 (ORCPT ); Sun, 17 Feb 2019 21:31:28 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2019 18:31:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,382,1544515200"; d="scan'208";a="134311016" Received: from unknown (HELO [10.239.13.114]) ([10.239.13.114]) by FMSMGA003.fm.intel.com with ESMTP; 17 Feb 2019 18:31:25 -0800 Message-ID: <5C6A1A28.40808@intel.com> Date: Mon, 18 Feb 2019 10:36:24 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: David Hildenbrand , 'Nitesh Narayan Lal' , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "pbonzini@redhat.com" , "lcapitulino@redhat.com" , "pagupta@redhat.com" , "yang.zhang.wz@gmail.com" , "riel@surriel.com" , "mst@redhat.com" , "dodgen@google.com" , "konrad.wilk@oracle.com" , "dhildenb@redhat.com" , "aarcange@redhat.com" Subject: Re: [RFC][Patch v8 0/7] KVM: Guest Free Page Hinting References: <20190204201854.2328-1-nitesh@redhat.com> <286AC319A985734F985F78AFA26841F73DF6B56A@shsmsx102.ccr.corp.intel.com> <286AC319A985734F985F78AFA26841F73DF6F0E3@shsmsx102.ccr.corp.intel.com> <286AC319A985734F985F78AFA26841F73DF71F38@shsmsx102.ccr.corp.intel.com> <751444f1-2ff8-e6f8-3501-b0408e3f6035@redhat.com> In-Reply-To: <751444f1-2ff8-e6f8-3501-b0408e3f6035@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/15/2019 05:41 PM, David Hildenbrand wrote: > On 15.02.19 10:05, Wang, Wei W wrote: >> On Thursday, February 14, 2019 5:43 PM, David Hildenbrand wrote: >>> Yes indeed, that is the important bit. They must not be put pack to the >>> buddy before they have been processed by the hypervisor. But as the pages >>> are not in the buddy, no one allocating a page will stumble over such a page >>> and try to allocate it. Threads trying to allocate memory will simply pick >>> another buddy page instead of "busy waiting" for that page to be finished >>> reporting. >> What if a guest thread try to allocate some pages but the buddy cannot satisfy >> because all the pages are isolated? Would it be the same case that the guest thread >> gets blocked by waiting all the isolated pages to get madvised by the host and >> returned to the guest buddy, or even worse, some guest threads get killed due to oom? > Your question targets low memory situations in the guest. I think Nitesh > already answered parts of that question somewhere and I'll let him > answer it in detail, only a short comment from my side :) > > I can imagine techniques where the OOM killer can be avoided, but the > OOM handler will eventually kick in and handle it. > > In general your question is valid and we will have to think about a way > to avoid that from happening. However, in contrast to your approach > blocking on potentially every page that is being hinted, in Nitesh's > approach this would only happen when the guest is really low on memory. > And the question is in general, if a guest wants to hint if low on > memory ("safety buffer"). I think we should forget that the guest is low on memory because this approach takes all the pages off the list, not because the guest really uses up the free memory. Guest allocating one page could also potentially be blocked until all the pages (as opposed to one page) being madvised and returned to the guest buddy. Best, Wei