From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH] Revert "mem: allocate in reverse to reduce fragmentation" Date: Tue, 24 Jul 2018 13:21:40 +0100 Message-ID: <0957f38f12ba6df24f0b48f24fe8236a6ce50efc.1532434698.git.anatoly.burakov@intel.com> Cc: thomas@monjalon.net, john.mcnamara@intel.com, zhihong.wang@intel.com, qian.q.xu@intel.com, yu.y.liu@intel.com, lei.a.yao@intel.com To: dev@dpdk.org Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id CA6FF235 for ; Tue, 24 Jul 2018 14:21:44 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This reverts commit 179f916e88e4a0fdd5ad4d20e226771d3d271c41. 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 above made it so that the memory is always allocated from the top of VA space, not from the bottom. Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_memalloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index a59f229cd..aa95551a8 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; -- 2.17.1