Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/40988/?format=api
https://patches.dpdk.org/api/patches/40988/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/4c43dd7982c8211249d45bf0e1ffbdd1ca788b1c.1528749451.git.anatoly.burakov@intel.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": "<4c43dd7982c8211249d45bf0e1ffbdd1ca788b1c.1528749451.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/4c43dd7982c8211249d45bf0e1ffbdd1ca788b1c.1528749451.git.anatoly.burakov@intel.com", "date": "2018-06-11T20:55:35", "name": "[2/9] fbarray: reduce duplication in find_contig code", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "e7bc681c48b1044b5d4a93ca3a25a77893d785af", "submitter": { "id": 4, "url": "https://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/4c43dd7982c8211249d45bf0e1ffbdd1ca788b1c.1528749451.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 85, "url": "https://patches.dpdk.org/api/series/85/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=85", "date": "2018-06-11T20:55:33", "name": "mem: reduce memory fragmentation", "version": 1, "mbox": "https://patches.dpdk.org/series/85/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/40988/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/40988/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 819241DE73;\n\tMon, 11 Jun 2018 22:55:53 +0200 (CEST)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 6CB891DB37\n\tfor <dev@dpdk.org>; Mon, 11 Jun 2018 22:55:46 +0200 (CEST)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Jun 2018 13:55:44 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga008.jf.intel.com with ESMTP; 11 Jun 2018 13:55:43 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw5BKtguh026371 for <dev@dpdk.org>; Mon, 11 Jun 2018 21:55:42 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w5BKtgCf021574\n\tfor <dev@dpdk.org>; Mon, 11 Jun 2018 21:55:42 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w5BKtgS4021570\n\tfor dev@dpdk.org; Mon, 11 Jun 2018 21:55:42 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,211,1526367600\"; d=\"scan'208\";a=\"48522981\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 11 Jun 2018 21:55:35 +0100", "Message-Id": "<4c43dd7982c8211249d45bf0e1ffbdd1ca788b1c.1528749451.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1528749451.git.anatoly.burakov@intel.com>", "<cover.1528749451.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1528749451.git.anatoly.burakov@intel.com>", "<cover.1528749451.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH 2/9] fbarray: reduce duplication in find_contig\n\tcode", "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://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": "<https://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": "Mostly a code move, to have all code related to find_contig in\none place. This slightly changes the API in that previously,\ncalling find_contig_free() on a full fbarray would've been\nan error, but equivalent call to find_contig_used() on an empty\narray does not return an error, leading to an inconsistency in\nthe API.\n\nThe decision was made to not treat this condition as an error,\nbecause it is equivalent to calling find_contig() on an index\nthat just happens to be used/free, which is not an error and\nwill return 0.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_fbarray.c | 52 ++++++++++++----------\n 1 file changed, 28 insertions(+), 24 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c\nindex 9ae942bfe..e37fe1e4d 100644\n--- a/lib/librte_eal/common/eal_common_fbarray.c\n+++ b/lib/librte_eal/common/eal_common_fbarray.c\n@@ -773,8 +773,8 @@ rte_fbarray_find_next_n_used(struct rte_fbarray *arr, unsigned int start,\n \treturn ret;\n }\n \n-int __rte_experimental\n-rte_fbarray_find_contig_free(struct rte_fbarray *arr, unsigned int start)\n+static int\n+fbarray_find_contig(struct rte_fbarray *arr, unsigned int start, bool used)\n {\n \tint ret = -1;\n \n@@ -786,14 +786,25 @@ rte_fbarray_find_contig_free(struct rte_fbarray *arr, unsigned int start)\n \t/* prevent array from changing under us */\n \trte_rwlock_read_lock(&arr->rwlock);\n \n-\tif (arr->len == arr->count) {\n-\t\trte_errno = ENOSPC;\n-\t\tgoto out;\n-\t}\n-\n-\tif (arr->count == 0) {\n-\t\tret = arr->len - start;\n-\t\tgoto out;\n+\t/* cheap checks to prevent doing useless work */\n+\tif (used) {\n+\t\tif (arr->count == 0) {\n+\t\t\tret = 0;\n+\t\t\tgoto out;\n+\t\t}\n+\t\tif (arr->len == arr->count) {\n+\t\t\tret = arr->len - start;\n+\t\t\tgoto out;\n+\t\t}\n+\t} else {\n+\t\tif (arr->len == arr->count) {\n+\t\t\tret = 0;\n+\t\t\tgoto out;\n+\t\t}\n+\t\tif (arr->count == 0) {\n+\t\t\tret = arr->len - start;\n+\t\t\tgoto out;\n+\t\t}\n \t}\n \n \tret = find_contig(arr, start, false);\n@@ -803,22 +814,15 @@ rte_fbarray_find_contig_free(struct rte_fbarray *arr, unsigned int start)\n }\n \n int __rte_experimental\n-rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start)\n+rte_fbarray_find_contig_free(struct rte_fbarray *arr, unsigned int start)\n {\n-\tint ret = -1;\n-\n-\tif (arr == NULL || start >= arr->len) {\n-\t\trte_errno = EINVAL;\n-\t\treturn -1;\n-\t}\n-\n-\t/* prevent array from changing under us */\n-\trte_rwlock_read_lock(&arr->rwlock);\n-\n-\tret = find_contig(arr, start, true);\n+\treturn fbarray_find_contig(arr, start, false);\n+}\n \n-\trte_rwlock_read_unlock(&arr->rwlock);\n-\treturn ret;\n+int __rte_experimental\n+rte_fbarray_find_contig_used(struct rte_fbarray *arr, unsigned int start)\n+{\n+\treturn fbarray_find_contig(arr, start, true);\n }\n \n int __rte_experimental\n", "prefixes": [ "2/9" ] }{ "id": 40988, "url": "