From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2] x86/PoD: shorten certain operations on higher order ranges Date: Tue, 29 Sep 2015 14:03:18 +0100 Message-ID: <560A8C16.8050803@citrix.com> References: <56096B3902000078000A63BE@prv-mh.provo.novell.com> <560A8218.90405@citrix.com> <560AA6E802000078000A6A64@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZguZ3-0005vr-P3 for xen-devel@lists.xenproject.org; Tue, 29 Sep 2015 13:03:25 +0000 In-Reply-To: <560AA6E802000078000A6A64@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: George Dunlap , xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 29/09/15 13:57, Jan Beulich wrote: >>>> On 29.09.15 at 14:20, wrote: >> On 28/09/15 15:30, Jan Beulich wrote: >>> --- a/xen/arch/x86/mm/p2m-pod.c >>> +++ b/xen/arch/x86/mm/p2m-pod.c >>> @@ -119,20 +119,23 @@ p2m_pod_cache_add(struct p2m_domain *p2m >>> >>> unlock_page_alloc(p2m); >>> >>> - /* Then add the first one to the appropriate populate-on-demand list */ >>> - switch(order) >>> + /* Then add to the appropriate populate-on-demand list. */ >>> + switch ( order ) >>> { >>> + case PAGE_ORDER_1G: >>> + for ( i = 0; i < (1UL << PAGE_ORDER_1G); i += 1UL << PAGE_ORDER_2M ) >>> + page_list_add_tail(page + i, &p2m->pod.super); >>> + break; >>> case PAGE_ORDER_2M: >>> - page_list_add_tail(page, &p2m->pod.super); /* lock: page_alloc */ >>> - p2m->pod.count += 1 << order; >>> + page_list_add_tail(page, &p2m->pod.super); >>> break; >>> case PAGE_ORDER_4K: >>> - page_list_add_tail(page, &p2m->pod.single); /* lock: page_alloc */ >>> - p2m->pod.count += 1; >>> + page_list_add_tail(page, &p2m->pod.single); >>> break; >>> default: >>> BUG(); >>> } >>> + p2m->pod.count += 1 << order; >> 1UL > Not really - the field is a "long" one, so at best 1L or 1U. And then > all the valid order values are visible right above, for none of them > it makes a difference, and there are ample similar uses scattered > around the file (yes, bad examples are no excuse, but in cases > where the suffix doesn't really matter I think it is better to omit it). > >> Otherwise, Reviewed-by: Andrew Cooper > Let me know regrading this one, For sanity sake, I would suggest going with 1L as one less place to go wrong when we gain 512GB superpages. ~Andrew