[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 6/8] evtchn: alter internal object handling scheme



On Fri, Aug 09, 2013 at 07:08:38PM +0100, David Vrabel wrote:
[...]
>  #define BITS_PER_EVTCHN_WORD(d) (has_32bit_shinfo(d) ? 32 : 
> BITS_PER_XEN_ULONG)
>  #endif
> -#define MAX_EVTCHNS(d) (BITS_PER_EVTCHN_WORD(d) * BITS_PER_EVTCHN_WORD(d))
> -#define EVTCHNS_PER_BUCKET 128
> -#define NR_EVTCHN_BUCKETS  (NR_EVENT_CHANNELS / EVTCHNS_PER_BUCKET)
> +
> +#define BUCKETS_PER_GROUP  (PAGE_SIZE/sizeof(struct evtchn *))
> +/* Round size of struct evtchn up to power of 2 size */
> +#define b2(x)   (   (x) | (   (x) >> 1) )
> +#define b4(x)   ( b2(x) | ( b2(x) >> 2) )
> +#define b8(x)   ( b4(x) | ( b4(x) >> 4) )
> +#define b16(x)  ( b8(x) | ( b8(x) >> 8) )
> +#define b32(x)  (b16(x) | (b16(x) >>16) )
> +#define next_power_of_2(x)      (b32(x-1) + 1)
> +

These macros are generic, can they be moved to a generic header so that
other code can reuse them?


Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.