X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fmm.c;h=1b70b74639ef2d267176b130b2312f6aaa2878e3;hb=99578627551cadf5f5c5b60b9700c4a1272d38f6;hp=f394e6da7631e1b1c7daf92d808b526de554c0e3;hpb=4527bc96ddd2dc67994a9c61e101b08d4850b094;p=palacios.git diff --git a/linux_module/mm.c b/linux_module/mm.c index f394e6d..1b70b74 100644 --- a/linux_module/mm.c +++ b/linux_module/mm.c @@ -76,7 +76,19 @@ void free_palacios_pgs(uintptr_t pg_addr, u64 num_pages) { int node_id = numa_addr_to_node(pg_addr); //DEBUG("Freeing Memory page %p\n", (void *)pg_addr); - buddy_free(memzones[node_id], pg_addr, get_order(num_pages * PAGE_SIZE) + PAGE_SHIFT); + if (buddy_free(memzones[node_id], pg_addr, get_order(num_pages * PAGE_SIZE) + PAGE_SHIFT)) { + // it is possible that the allocation was actually on a different zone, + // so, just to be sure, we'll try to dellocate on each + for (node_id=0;node_idbase_addr = page_to_pfn(pgs) << PAGE_SHIFT; } @@ -288,11 +300,13 @@ int palacios_init_mm( void ) { { struct page * pgs; - + int actual_node; + // attempt to first allocate below 4 GB for compatibility with // 32 bit shadow paging pgs = alloc_pages_node(node_id, GFP_DMA32, MAX_ORDER - 1); + if (!pgs) { INFO("Could not allocate initial memory block for node %d below 4GB\n", node_id); @@ -306,7 +320,18 @@ int palacios_init_mm( void ) { palacios_deinit_mm(); return -1; } + } else { + actual_node=numa_addr_to_node((uintptr_t)(page_to_pfn(pgs) << PAGE_SHIFT)); + if (actual_node != node_id) { + WARNING("Initial 64 bit allocation attempt for node %d resulted in allocation on node %d\n",node_id,actual_node); + } } + + } else { + actual_node=numa_addr_to_node((uintptr_t)(page_to_pfn(pgs) << PAGE_SHIFT)); + if (actual_node != node_id) { + WARNING("Initial 32bit-limited allocation attempt for node %d resulted in allocation on node %d\n",node_id,actual_node); + } } seed_addrs[node_id] = page_to_pfn(pgs) << PAGE_SHIFT;