From: Keir Fraser Subject: Re: [PATCH] Add hypercall to mark superpages to improve performance Date: Fri, 30 Apr 2010 14:34:57 -0700 Message-ID: References: <201004301443.23350.dcm@mccr.org> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <201004301443.23350.dcm@mccr.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dave McCracken Cc: Jeremy Fitzhardinge , Xen Developers List List-Id: xen-devel@lists.xenproject.org On 30/04/2010 12:43, "Dave McCracken" wrote: >> Finally, does this really require new hypercalls? Could there not instead >> be an always-enabled robust method for Xen to do superpage tracking? > > I'm open to alternative suggestions on how to lock superpages into writable > state once they're mapped without having to touch each individual page, even > on the first map/unmap. We could refcount superpage mappings in the base page > of each superpage and then whenever a small page is mapped check its base > page, but that would require an additional refcounted field in struct > page_info. I figured that would not be considered acceptable. One option would be an array of reference counts indexed by superpage number (i.e, mfn>>9). So kind of a separate array to page_info, and a non-zero superpage refcount would arrange to hold a reference on every relevant page in page_info. That could be implemented with no extra hypercalls, and I reckon it's probably easier to make this race-free too. Obviously it does have extra code complexity to construct this array (which I suppose needs to be sparse, just like page_info array, in the face of very sparse memory maps). The space overhead (about 8 bytes per 2MB, or 0.0004% of total system memory) would be trivial. Compared with an extra reference count in every page_info, which would have a much higher 0.2% overhead. -- Keir