[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] mm: MEMF_node should handle changes in nodeid_t size
commit befe0a0da90d7ac063fd8b5891c7d0caeeeefa5f Author: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> AuthorDate: Thu Feb 26 14:08:34 2015 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Feb 26 14:10:24 2015 +0100 mm: MEMF_node should handle changes in nodeid_t size Instead of using a hardcoded constant to extract nodeID from memflags use a macro whose value is based on nodeid_t size. Also provide a macro for extracting nodeID from memflags so that users don't need to remember to decrement the value. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> MASK_EXTR() can't be used in MEMF2NODE() (also renamed to MEMF_get_node()). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/common/page_alloc.c | 5 ++++- xen/include/xen/mm.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 6bd3b75..d96d25b 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -581,13 +581,16 @@ static struct page_info *alloc_heap_pages( struct domain *d) { unsigned int i, j, zone = 0, nodemask_retry = 0; - nodeid_t first_node, node = (nodeid_t)((memflags >> _MEMF_node) - 1); + nodeid_t first_node, node = MEMF_get_node(memflags); unsigned long request = 1UL << order; struct page_info *pg; nodemask_t nodemask = (d != NULL ) ? d->node_affinity : node_online_map; bool_t need_tlbflush = 0; uint32_t tlbflush_timestamp = 0; + /* Make sure there are enough bits in memflags for nodeID. */ + BUILD_BUG_ON((_MEMF_bits - _MEMF_node) < (8 * sizeof(nodeid_t))); + if ( node == NUMA_NO_NODE ) { memflags &= ~MEMF_exact_node; diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index a62ee1e..6ea8b8c 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -121,7 +121,9 @@ struct npfec { #define _MEMF_exact_node 4 #define MEMF_exact_node (1U<<_MEMF_exact_node) #define _MEMF_node 8 -#define MEMF_node(n) ((((n)+1)&0xff)<<_MEMF_node) +#define MEMF_node_mask ((1U << (8 * sizeof(nodeid_t))) - 1) +#define MEMF_node(n) ((((n) + 1) & MEMF_node_mask) << _MEMF_node) +#define MEMF_get_node(f) ((((f) >> _MEMF_node) - 1) & MEMF_node_mask) #define _MEMF_bits 24 #define MEMF_bits(n) ((n)<<_MEMF_bits) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |