From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Duyck Subject: Re: [PATCH v2 0/3] kvm: Use huge pages for DAX-backed files Date: Mon, 03 Dec 2018 10:32:00 -0800 Message-ID: <714716fde90865e195848f1a9a38e9134e75ad29.camel@linux.intel.com> References: <20181109203921.178363-1-brho@google.com> <20181114215155.259978-1-brho@google.com> <20181203124051.05c1d2ce@gnomeregan.cam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: X86 ML , "Zhang, Yu C" , KVM list , rkrcmar-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, linux-nvdimm , Linux Kernel Mailing List , Ingo Molnar , Borislav Petkov , zwisler-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Paolo Bonzini , Thomas Gleixner , "H. Peter Anvin" , "Zhang, Yi Z" To: Barret Rhoden , Dan Williams Return-path: In-Reply-To: <20181203124051.05c1d2ce-5rj//V2oKXqT+5UN0cW69VLMcqb5oVE02SarAXORi/o@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" List-Id: kvm.vger.kernel.org On Mon, 2018-12-03 at 12:40 -0500, Barret Rhoden wrote: > On 2018-11-14 at 16:55 Dan Williams wrote: > > [ add Alex who is looking into removing PageReserved for DAX pages. ] > > Thanks. I can keep my eye out for his patches and repost once that's > done. > > Alternatively, if you all want to merge this before the PageReserved / > DAX changes, then I can repost - just Ack/Review tags. It's harmless > with the existing PageReserved behavior. > > Thanks, > > Barret So the latest version of my generic memory init patches are up at: https://lore.kernel.org/lkml/154361452447.7497.1348692079883153517.stgit-+uVpp3jiz/SWyQ3uPIV3rPooFf0ArEBIu+b9c/7xato@public.gmane.org/ To be honest I am not entirely convinced that dropping PageReserved is the right thing to do for DAX pages. I've been trying to work out a few different issues but not having much luck. It seems like the main issue is that the PageReserved bit is being used to indicate 2 different things in a few spots throughout the kernel. The definition of the PG_reserved flag reads like it should apply to DAX pages: PG_reserved is set for special pages, which can never be swapped out. Some of them might not even exist... PageReserved essentially means you aren't supposed to be migrating or swapping the page. The problem here is that I believe this logic should apply to DAX pages and so in many cases it makes sense to leave the flag set for DAX pages. Otherwise you have to go through and start special casing all the spots where normal memory falls through and add a check to see if we have a DAX page. The second use for the PG_reserved flag is to test for if you can pin the page or not. This I think is the reason why many are just assuming PageReserved == MMIO like KVM does. However this is a bad assumption to be making since the introduction of DAX, HMM, and P2PDMA allows MMIO memory to start doing different things like supporting pinning. I also believe it would be a bad reason to clear the flag for DAX pages. Thanks. - Alex