From patchwork Tue Jul 24 12:21:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 43309 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3363A2BF1; Tue, 24 Jul 2018 14:21:46 +0200 (CEST) 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2018 05:21:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,398,1526367600"; d="scan'208";a="75468082" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 24 Jul 2018 05:21:41 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w6OCLfFT010996; Tue, 24 Jul 2018 13:21:41 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w6OCLe0M024004; Tue, 24 Jul 2018 13:21:40 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w6OCLeIK024000; Tue, 24 Jul 2018 13:21:40 +0100 From: Anatoly Burakov To: dev@dpdk.org 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 Date: Tue, 24 Jul 2018 13:21:40 +0100 Message-Id: <0957f38f12ba6df24f0b48f24fe8236a6ce50efc.1532434698.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] Revert "mem: allocate in reverse to reduce fragmentation" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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;