From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: Re: [PATCH] Add hypercall to mark superpages to improve performance Date: Mon, 3 May 2010 17:29:14 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: 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 03/05/2010 17:09, "Keir Fraser" wrote: >> It should be simple enough to also check superpage->count_info in those >> places. So the total mappings of a page would be page->count_info + >> superpage->count_info. Good thing you suggested we also have a count in= the >> superpage_info struct :) >=20 > I think you're going to have trouble handling two separate reference coun= ts, > for superpages and single pages, in a race-free manner that is any better > than checking/updating reference counts across all pages in a superpage o= n > first superpage mapping. For example: When making first superpage mapping, how do you know that all pages belong to the relevant domain, without scanning every page_info? When destructing last superpage mapping (or single-page mapping) how do you safely check the 'other' reference count to decide whether the page is freeable, without having races (last single-page and superpage mappings could be destructed concurrently, need to ensure any given page gets freed exactly once). And I could think of others no doubt... Just pointing out ho= w careful you have to be if you think you can avoid the na=EFve refcount-updatign algorithms I suggested. I'd rather shoot down the obvious races before you do the coding. -- Keir