Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/6234/?format=api
https://patches.dpdk.org/api/patches/6234/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1436433566-328-3-git-send-email-david.marchand@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": "<1436433566-328-3-git-send-email-david.marchand@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1436433566-328-3-git-send-email-david.marchand@6wind.com", "date": "2015-07-09T09:19:22", "name": "[dpdk-dev,v2,2/6] eal/linux: remove useless casts", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "ef6e15c4805d0b6fae15f48198ed1e8803306999", "submitter": { "id": 3, "url": "https://patches.dpdk.org/api/people/3/?format=api", "name": "David Marchand", "email": "david.marchand@6wind.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1436433566-328-3-git-send-email-david.marchand@6wind.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/6234/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/6234/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 61262C372;\n\tThu, 9 Jul 2015 11:19:49 +0200 (CEST)", "from mail-wi0-f177.google.com (mail-wi0-f177.google.com\n\t[209.85.212.177]) by dpdk.org (Postfix) with ESMTP id 899D9C344\n\tfor <dev@dpdk.org>; Thu, 9 Jul 2015 11:19:45 +0200 (CEST)", "by widjy10 with SMTP id jy10so239200866wid.1\n\tfor <dev@dpdk.org>; Thu, 09 Jul 2015 02:19:45 -0700 (PDT)", "from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.151.210])\n\tby smtp.gmail.com with ESMTPSA id\n\tum5sm7774777wjc.1.2015.07.09.02.19.43 for <dev@dpdk.org>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 09 Jul 2015 02:19:44 -0700 (PDT)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=m8iyycUNf0MwmqDl5H9qWjhb8y4sqB263BNCfUR9zn0=;\n\tb=Zy1yuzw6eQS1h7ji9uEAFMd717LFqODLbafgROV+1ANCRpAS+U5bTG+pnIEhCZSmWG\n\t0AHgXRCdbVSfCoYPfznWKX/ZC4WuH5c3//C16Ez7WA7rPREABgqBB+V68pEnh9eq/GU/\n\ts/9IxaiY4wR1322wpNkGeBsuKURmFQYOC76o0hu1ivACTJsDYV6YuOIQlVMBeVy5hLga\n\tkYOwvoX/Rez5rHbjjtmmWVEeeU0Z2suQIXWKFFir/gY6FwKP8GswQzAMise/MDrBXYhS\n\tJwSPL8WAUDtcvu5BhRDcRXy+f+api3QVknI+HhzVPs0cXWMXRO+ZQNCvEyZykLVVghYy\n\tCrIQ==", "X-Gm-Message-State": "ALoCoQki94r+87GKQuloKn7WJATTHr3ankByEyYp7knp2exM0pb+zRUXyO6KhipSHlQ3sE5rANrb", "X-Received": "by 10.194.201.71 with SMTP id jy7mr29283877wjc.93.1436433585412; \n\tThu, 09 Jul 2015 02:19:45 -0700 (PDT)", "From": "David Marchand <david.marchand@6wind.com>", "To": "dev@dpdk.org", "Date": "Thu, 9 Jul 2015 11:19:22 +0200", "Message-Id": "<1436433566-328-3-git-send-email-david.marchand@6wind.com>", "X-Mailer": "git-send-email 1.7.10.4", "In-Reply-To": "<1436433566-328-1-git-send-email-david.marchand@6wind.com>", "References": "<1436259634-7077-1-git-send-email-david.marchand@6wind.com>\n\t<1436433566-328-1-git-send-email-david.marchand@6wind.com>", "Subject": "[dpdk-dev] [PATCH v2 2/6] eal/linux: remove useless casts", "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": "Rather than cast the huge pages number returned by get_num_hugepages, rework\nthis function so that it returns 0 when something goes wrong.\nAnd no need for casts in log.\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\nAcked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>\n---\n lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 26 +++++++++++++++--------\n 1 file changed, 17 insertions(+), 9 deletions(-)", "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c\nindex 6dd8a0b..91e288c 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c\n@@ -63,7 +63,7 @@ static const char sys_dir_path[] = \"/sys/kernel/mm/hugepages\";\n \n /* this function is only called from eal_hugepage_info_init which itself\n * is only called from a primary process */\n-static int32_t\n+static uint32_t\n get_num_hugepages(const char *subdir)\n {\n \tchar path[PATH_MAX];\n@@ -87,10 +87,17 @@ get_num_hugepages(const char *subdir)\n \t\t\t\tsubdir);\n \n \t/* adjust num_pages */\n-\tif (num_pages > 0)\n+\tif (num_pages >= resv_pages)\n \t\tnum_pages -= resv_pages;\n+\telse if (resv_pages)\n+\t\tnum_pages = 0;\n \n-\treturn (int32_t)num_pages;\n+\t/* we want to return a uint32_t and more than this looks suspicious\n+\t * anyway ... */\n+\tif (num_pages > UINT32_MAX)\n+\t\tnum_pages = UINT32_MAX;\n+\n+\treturn num_pages;\n }\n \n static uint64_t\n@@ -288,12 +295,13 @@ eal_hugepage_info_init(void)\n \n \t\t\t/* first, check if we have a mountpoint */\n \t\t\tif (hpi->hugedir == NULL){\n-\t\t\t\tint32_t num_pages;\n-\t\t\t\tif ((num_pages = get_num_hugepages(dirent->d_name)) > 0)\n-\t\t\t\t\tRTE_LOG(INFO, EAL, \"%u hugepages of size %llu reserved, \"\\\n-\t\t\t\t\t\t\t\"but no mounted hugetlbfs found for that size\\n\",\n-\t\t\t\t\t\t\t(unsigned)num_pages,\n-\t\t\t\t\t\t\t(unsigned long long)hpi->hugepage_sz);\n+\t\t\t\tuint32_t num_pages;\n+\n+\t\t\t\tnum_pages = get_num_hugepages(dirent->d_name);\n+\t\t\t\tif (num_pages > 0)\n+\t\t\t\t\tRTE_LOG(INFO, EAL, \"%\" PRIu32 \" hugepages of size %\" PRIu64 \" reserved, \"\n+\t\t\t\t\t\t\"but no mounted hugetlbfs found for that size\\n\",\n+\t\t\t\t\t\tnum_pages, hpi->hugepage_sz);\n \t\t\t} else {\n \t\t\t\t/* try to obtain a writelock */\n \t\t\t\thpi->lock_descriptor = open(hpi->hugedir, O_RDONLY);\n", "prefixes": [ "dpdk-dev", "v2", "2/6" ] }{ "id": 6234, "url": "