Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/62111/?format=api
http://patchwork.dpdk.org/api/patches/62111/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20191028140122.9592-5-olivier.matz@6wind.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20191028140122.9592-5-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20191028140122.9592-5-olivier.matz@6wind.com", "date": "2019-10-28T14:01:21", "name": "[4/5] mempool: introduce function to get mempool page size", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e9f836772b9cdcc9e89acb4948fe2aa285f603d7", "submitter": { "id": 8, "url": "http://patchwork.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.com" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20191028140122.9592-5-olivier.matz@6wind.com/mbox/", "series": [ { "id": 7108, "url": "http://patchwork.dpdk.org/api/series/7108/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=7108", "date": "2019-10-28T14:01:17", "name": "mempool: avoid objects allocations across pages", "version": 1, "mbox": "http://patchwork.dpdk.org/series/7108/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/62111/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/62111/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A8E611BF48;\n\tMon, 28 Oct 2019 15:02:03 +0100 (CET)", "from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com\n\t[62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 807F81BEF3\n\tfor <dev@dpdk.org>; Mon, 28 Oct 2019 15:01:51 +0100 (CET)", "from glumotte.dev.6wind.com. (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 558EE3373B5;\n\tMon, 28 Oct 2019 15:01:51 +0100 (CET)" ], "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org", "Cc": "Anatoly Burakov <anatoly.burakov@intel.com>,\n\tAndrew Rybchenko <arybchenko@solarflare.com>,\n\tFerruh Yigit <ferruh.yigit@linux.intel.com>,\n\t\"Giridharan, Ganesan\" <ggiridharan@rbbn.com>,\n\tJerin Jacob Kollanukkaran <jerinj@marvell.com>,\n\t\"Kiran Kumar Kokkilagadda\" <kirankumark@marvell.com>,\n\tStephen Hemminger <sthemmin@microsoft.com>,\n\tThomas Monjalon <thomas@monjalon.net>,\n\tVamsi Krishna Attunuru <vattunuru@marvell.com>", "Date": "Mon, 28 Oct 2019 15:01:21 +0100", "Message-Id": "<20191028140122.9592-5-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20191028140122.9592-1-olivier.matz@6wind.com>", "References": "<20190719133845.32432-1-olivier.matz@6wind.com>\n\t<20191028140122.9592-1-olivier.matz@6wind.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 4/5] mempool: introduce function to get mempool\n\tpage size", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "In rte_mempool_populate_default(), we determine the page size,\nwhich is needed for calc_size and allocation of memory.\n\nMove this in a function and export it, it will be used in next\ncommit.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n lib/librte_mempool/rte_mempool.c | 51 ++++++++++++++--------\n lib/librte_mempool/rte_mempool.h | 7 +++\n lib/librte_mempool/rte_mempool_version.map | 1 +\n 3 files changed, 40 insertions(+), 19 deletions(-)", "diff": "diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c\nindex 5e1f202dc..7664764e5 100644\n--- a/lib/librte_mempool/rte_mempool.c\n+++ b/lib/librte_mempool/rte_mempool.c\n@@ -411,6 +411,33 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,\n \treturn ret;\n }\n \n+/* Get the minimal page size used in a mempool before populating it. */\n+int\n+rte_mempool_get_page_size(struct rte_mempool *mp, size_t *pg_sz)\n+{\n+\tbool need_iova_contig_obj;\n+\tbool alloc_in_ext_mem;\n+\tint ret;\n+\n+\t/* check if we can retrieve a valid socket ID */\n+\tret = rte_malloc_heap_socket_is_external(mp->socket_id);\n+\tif (ret < 0)\n+\t\treturn -EINVAL;\n+\talloc_in_ext_mem = (ret == 1);\n+\tneed_iova_contig_obj = !(mp->flags & MEMPOOL_F_NO_IOVA_CONTIG);\n+\n+\tif (!need_iova_contig_obj)\n+\t\t*pg_sz = 0;\n+\telse if (!alloc_in_ext_mem && rte_eal_iova_mode() == RTE_IOVA_VA)\n+\t\t*pg_sz = 0;\n+\telse if (rte_eal_has_hugepages() || alloc_in_ext_mem)\n+\t\t*pg_sz = get_min_page_size(mp->socket_id);\n+\telse\n+\t\t*pg_sz = getpagesize();\n+\n+\treturn 0;\n+}\n+\n /* Default function to populate the mempool: allocate memory in memzones,\n * and populate them. Return the number of objects added, or a negative\n * value on error.\n@@ -422,12 +449,11 @@ rte_mempool_populate_default(struct rte_mempool *mp)\n \tchar mz_name[RTE_MEMZONE_NAMESIZE];\n \tconst struct rte_memzone *mz;\n \tssize_t mem_size;\n-\tsize_t align, pg_sz, pg_shift;\n+\tsize_t align, pg_sz, pg_shift = 0;\n \trte_iova_t iova;\n \tunsigned mz_id, n;\n \tint ret;\n \tbool need_iova_contig_obj;\n-\tbool alloc_in_ext_mem;\n \n \tret = mempool_ops_alloc_once(mp);\n \tif (ret != 0)\n@@ -482,26 +508,13 @@ rte_mempool_populate_default(struct rte_mempool *mp)\n \t * synonymous with IOVA contiguousness will not hold.\n \t */\n \n-\t/* check if we can retrieve a valid socket ID */\n-\tret = rte_malloc_heap_socket_is_external(mp->socket_id);\n-\tif (ret < 0)\n-\t\treturn -EINVAL;\n-\talloc_in_ext_mem = (ret == 1);\n \tneed_iova_contig_obj = !(mp->flags & MEMPOOL_F_NO_IOVA_CONTIG);\n+\tret = rte_mempool_get_page_size(mp, &pg_sz);\n+\tif (ret < 0)\n+\t\treturn ret;\n \n-\tif (!need_iova_contig_obj) {\n-\t\tpg_sz = 0;\n-\t\tpg_shift = 0;\n-\t} else if (!alloc_in_ext_mem && rte_eal_iova_mode() == RTE_IOVA_VA) {\n-\t\tpg_sz = 0;\n-\t\tpg_shift = 0;\n-\t} else if (rte_eal_has_hugepages() || alloc_in_ext_mem) {\n-\t\tpg_sz = get_min_page_size(mp->socket_id);\n-\t\tpg_shift = rte_bsf32(pg_sz);\n-\t} else {\n-\t\tpg_sz = getpagesize();\n+\tif (pg_sz != 0)\n \t\tpg_shift = rte_bsf32(pg_sz);\n-\t}\n \n \tfor (mz_id = 0, n = mp->size; n > 0; mz_id++, n -= ret) {\n \t\tsize_t min_chunk_size;\ndiff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex 8fa3c04e5..6d98b3743 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -1691,6 +1691,13 @@ uint32_t rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags,\n void rte_mempool_walk(void (*func)(struct rte_mempool *, void *arg),\n \t\t void *arg);\n \n+/**\n+ * @internal Get page size used for mempool object allocation.\n+ */\n+__rte_experimental\n+int\n+rte_mempool_get_page_size(struct rte_mempool *mp, size_t *pg_sz);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map\nindex 17cbca460..4eff2767d 100644\n--- a/lib/librte_mempool/rte_mempool_version.map\n+++ b/lib/librte_mempool/rte_mempool_version.map\n@@ -56,5 +56,6 @@ DPDK_18.05 {\n EXPERIMENTAL {\n \tglobal:\n \n+\trte_mempool_get_page_size;\n \trte_mempool_ops_get_info;\n };\n", "prefixes": [ "4/5" ] }{ "id": 62111, "url": "