From: Anatoly Burakov Date: Tue, 24 Jul 2018 12:21:40 +0000 (+0100) Subject: mem: revert reversed allocation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7350d1be051a1c8fc140e116755c3c6609e8de37;p=dpdk.git mem: revert reversed allocation A few regressions with virtio/vhost have been discovered, due to the strong dependency of virtio/vhost on the underlying memory layout. Specifically, virtio/vhost share all memory pages starting from the beginning of the segment, while the patch below made it so that the memory is always allocated from the top of VA space, not from the bottom. Fixes: 179f916e88e4 ("mem: allocate in reverse to reduce fragmentation") Signed-off-by: Anatoly Burakov --- diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index a59f229cd4..aa95551a8f 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c @@ -731,8 +731,7 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg) need = wa->n_segs; /* try finding space in memseg list */ - cur_idx = rte_fbarray_find_prev_n_free(&cur_msl->memseg_arr, - cur_msl->memseg_arr.len - 1, need); + cur_idx = rte_fbarray_find_next_n_free(&cur_msl->memseg_arr, 0, need); if (cur_idx < 0) return 0; start_idx = cur_idx;