Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11296782ybi; Thu, 25 Jul 2019 13:39:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzepr3gioxeO4gkfVkWNdHR7+a3izlmV5GVNI/Z7YN45KH5PaatGs3K0NfAmwzyKEljbS8f X-Received: by 2002:a17:902:b285:: with SMTP id u5mr4400570plr.329.1564087156860; Thu, 25 Jul 2019 13:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564087156; cv=none; d=google.com; s=arc-20160816; b=JLgkRaJ4Js6TOP/15Xc8zQeVH1GKziLdElqP0KGGzX48LXu4DGY9AgOZePFOA2iDF+ sEY/d53yce7kL9QgGOyYX6WEhAEeoAB1LYLn2n4yY2Yq5D6ldwGAypzfiMW6Ncnqrxsp LNUxmArenNEORU9UMv098mnspO0QLEjb+aqDjSvGdpKFaLVituk36izxmnzDRcDDy1nU 5Nt8pc7Arga168qZb7JMO7Yh76zGXKPxOEEMQZ8FJ5iBDophn1zEsh51kzlx82goMy3N O4vKTBfN09cAKBGofAn6GwnGNY0Ap+1N3pd3/019MdrNpYqvFB9io5VZCj+UuUXrktZj bRCA== 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=9VxVWkjz8i8Ba3093MQa2NFKzuRKZz1r56kvqf7p+BU=; b=A4Hbl1/+WC56isEBTTig4Rvia/yQNVsQO4gffKR5FD3BTIoHlDlwoyIiIAE8j3KRSt bFgr2oi59UNeHcXL3TRXOxNPunj4xVrc3FMRv5DI/pkrMLAy0iA3IKT4Ylt3nxu2IXPb V4N7OzR0v4YSwkAJUlzkTSUb7vvidcf5jvKApuD6XoxG6yqk4howvTiuJPxrUr3NAtBB b8CN88oEsBGpj1W3EBcQmrYZhOMO5xZFwEBZNwfajK4i8MPtVxMXK0R2MB/dMP8pd3Gh DpJNbXJrGK+2t894Xlbb1e45YO5M5cNrVN5TJxfMw/QbOp6VHmIVq/iRcCfZI7OymUJP ShqQ== 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 e1si9382329pge.227.2019.07.25.13.39.02; Thu, 25 Jul 2019 13:39:16 -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 S1726869AbfGYUhE (ORCPT + 99 others); Thu, 25 Jul 2019 16:37:04 -0400 Received: from mga03.intel.com ([134.134.136.65]:58797 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726195AbfGYUhD (ORCPT ); Thu, 25 Jul 2019 16:37:03 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 13:37:02 -0700 X-IronPort-AV: E=Sophos;i="5.64,308,1559545200"; d="scan'208";a="161090207" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 13:37:02 -0700 Message-ID: <5f78cccab8273cb759538ef6e088886a507ce438.camel@linux.intel.com> Subject: Re: [PATCH v2 4/5] mm: Introduce Hinted pages From: Alexander Duyck To: David Hildenbrand , Alexander Duyck Cc: Nitesh Narayan Lal , kvm list , "Michael S. Tsirkin" , 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, Matthew Wilcox Date: Thu, 25 Jul 2019 13:37:02 -0700 In-Reply-To: References: <20190724165158.6685.87228.stgit@localhost.localdomain> <20190724170259.6685.18028.stgit@localhost.localdomain> 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 Thu, 2019-07-25 at 20:32 +0200, David Hildenbrand wrote: > On 25.07.19 19:38, Alexander Duyck wrote: > > On Thu, 2019-07-25 at 18:48 +0200, David Hildenbrand wrote: > > > On 25.07.19 17:59, Alexander Duyck wrote: > > > > On Thu, Jul 25, 2019 at 1:53 AM David Hildenbrand wrote: > > > > > On 24.07.19 19:03, Alexander Duyck wrote: > > > > > > From: Alexander Duyck > > > > > > > > > > > Can't we reuse one of the traditional page flags for that, not used > > > > > along with buddy pages? E.g., PG_dirty: Pages that were not hinted yet > > > > > are dirty. > > > > > > > > Reusing something like the dirty bit would just be confusing in my > > > > opinion. In addition it looks like Xen has also re-purposed PG_dirty > > > > already for another purpose. > > > > > > You brought up waste page management. A dirty bit for unprocessed pages > > > fits perfectly in this context. Regarding XEN, as long as it's not used > > > along with buddy pages, no issue. > > > > I would rather not have to dirty all pages that aren't hinted. That starts > > to get too invasive. Ideally we only modify pages if we are hinting on > > them. That is why I said I didn't like the use of a dirty bit. What we > > want is more of a "guaranteed clean" bit. > > Not sure if that is too invasive, but fair enough. > > > > FWIW, I don't even thing PG_offline matches to what you are using it > > > here for. The pages are not logically offline. They were simply buddy > > > pages that were hinted. (I'd even prefer a separate page type for that > > > instead - if we cannot simply reuse one of the other flags) > > > > > > "Offline pages" that are not actually offline in the context of the > > > buddy is way more confusing. > > > > Right now offline and hinted are essentially the same thing since the > > effect is identical. > > No they are not the same thing. Regarding virtio-balloon: You are free > to reuse any hinted pages immediate. Offline pages (a.k.a. inflated) you > might not generally reuse before deflating. Okay, so it sounds like your perspective is a bit different than mine. I was thinking of it from the perspective of the host OS where in either case the guest has set the page as MADV_DONTNEED. You are looking at it from the guest perspective where Offline means the guest cannot use it. > > There may be cases in the future where that is not the case, but with the > > current patch set they both result in the pages being evicted from the > > guest. > > > > > > If anything I could probably look at seeing if the PG_private flags > > > > are available when a page is in the buddy allocator which I suspect > > > > they probably are since the only users I currently see appear to be > > > > SLOB and compound pages. Either that or maybe something like PG_head > > > > might make sense since once we start allocating them we are popping > > > > the head off of the boundary list. > > > > > > Would also be fine with me. > > > > Actually I may have found an even better bit if we are going with the > > "reporting" name. I could probably use "PG_uptodate" since it looks like > > most of its uses are related to filesystems. I will wait till I hear from > > Matthew on what bits would be available for use before I update things. > > Also fine with me. In the optimal case we (in my opinion) > a) Don't reuse PG_offline > b) Don't use another page type That is fine. I just need to determine the exact flag to use then. I'll do some more research and wait to see if anyone else from MM comunity has input or suggestions on the page flag to be used. From what I can tell it looks like there are a bunch of flag bits that are unused as far as the buddy pages are concerned so I should have a few to choose from.