Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/11317/?format=api
https://patches.dpdk.org/api/patches/11317/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1457540381-20274-26-git-send-email-olivier.matz@6wind.com/", "project": { "id": 1, "url": "https://patches.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": "<1457540381-20274-26-git-send-email-olivier.matz@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1457540381-20274-26-git-send-email-olivier.matz@6wind.com", "date": "2016-03-09T16:19:31", "name": "[dpdk-dev,RFC,25/35] mempool: introduce a function to free a mempool", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8399e1599601af7623c46b2d3ae8f1b94be331bc", "submitter": { "id": 8, "url": "https://patches.dpdk.org/api/people/8/?format=api", "name": "Olivier Matz", "email": "olivier.matz@6wind.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1457540381-20274-26-git-send-email-olivier.matz@6wind.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/11317/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/11317/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 7A2155A56;\n\tWed, 9 Mar 2016 17:22:41 +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 842684CE4\n\tfor <dev@dpdk.org>; Wed, 9 Mar 2016 17:22:15 +0100 (CET)", "from glumotte.dev.6wind.com (unknown [10.16.0.195])\n\tby proxy.6wind.com (Postfix) with ESMTP id 7F3E424C16\n\tfor <dev@dpdk.org>; Wed, 9 Mar 2016 17:21:32 +0100 (CET)" ], "From": "Olivier Matz <olivier.matz@6wind.com>", "To": "dev@dpdk.org", "Date": "Wed, 9 Mar 2016 17:19:31 +0100", "Message-Id": "<1457540381-20274-26-git-send-email-olivier.matz@6wind.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1457540381-20274-1-git-send-email-olivier.matz@6wind.com>", "References": "<1457540381-20274-1-git-send-email-olivier.matz@6wind.com>", "Subject": "[dpdk-dev] [RFC 25/35] mempool: introduce a function to free a\n\tmempool", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Introduce rte_mempool_free() that:\n\n- unlink the mempool from the global list if it is found\n- free all the memory chunks using their free callbacks\n- free the internal ring\n- free the memzone containing the mempool\n\nCurrently this function is only used in error cases when\ncreating a new mempool, but it will be made public later\nin the patch series.\n\nSigned-off-by: Olivier Matz <olivier.matz@6wind.com>\n---\n lib/librte_mempool/rte_mempool.c | 36 ++++++++++++++++++++++++++++++------\n 1 file changed, 30 insertions(+), 6 deletions(-)", "diff": "diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c\nindex 9e2b72b..4b74ffd 100644\n--- a/lib/librte_mempool/rte_mempool.c\n+++ b/lib/librte_mempool/rte_mempool.c\n@@ -618,6 +618,35 @@ rte_mempool_populate_default(struct rte_mempool *mp)\n \treturn ret;\n }\n \n+/* free a mempool */\n+static void\n+rte_mempool_free(struct rte_mempool *mp)\n+{\n+\tstruct rte_mempool_list *mempool_list = NULL;\n+\tstruct rte_tailq_entry *te;\n+\n+\tif (mp == NULL)\n+\t\treturn;\n+\n+\tmempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);\n+\trte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);\n+\t/* find out tailq entry */\n+\tTAILQ_FOREACH(te, mempool_list, next) {\n+\t\tif (te->data == (void *)mp)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (te != NULL) {\n+\t\tTAILQ_REMOVE(mempool_list, te, next);\n+\t\trte_free(te);\n+\t}\n+\trte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);\n+\n+\trte_mempool_free_memchunks(mp);\n+\trte_ring_free(mp->ring);\n+\trte_memzone_free(mp->mz);\n+}\n+\n /*\n * Create the mempool over already allocated chunk of memory.\n * That external memory buffer can consists of physically disjoint pages.\n@@ -777,12 +806,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,\n \n exit_unlock:\n \trte_rwlock_write_unlock(RTE_EAL_MEMPOOL_RWLOCK);\n-\tif (mp != NULL) {\n-\t\trte_mempool_free_memchunks(mp);\n-\t\trte_ring_free(mp->ring);\n-\t}\n-\trte_free(te);\n-\trte_memzone_free(mz);\n+\trte_mempool_free(mp);\n \n \treturn NULL;\n }\n", "prefixes": [ "dpdk-dev", "RFC", "25/35" ] }{ "id": 11317, "url": "