Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/76268/?format=api
https://patches.dpdk.org/api/patches/76268/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200901165643.15668-1-stephen@networkplumber.org/", "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": "<20200901165643.15668-1-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20200901165643.15668-1-stephen@networkplumber.org", "date": "2020-09-01T16:56:43", "name": "usertools: add huge page setup script", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c46b0ec9d50096cd718e4403c9d1d1a4e15b4145", "submitter": { "id": 27, "url": "https://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "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/20200901165643.15668-1-stephen@networkplumber.org/mbox/", "series": [ { "id": 11880, "url": "https://patches.dpdk.org/api/series/11880/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11880", "date": "2020-09-01T16:56:43", "name": "usertools: add huge page setup script", "version": 1, "mbox": "https://patches.dpdk.org/series/11880/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/76268/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/76268/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9F70FA04AC;\n\tTue, 1 Sep 2020 18:56:55 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D2BEE1C0B0;\n\tTue, 1 Sep 2020 18:56:54 +0200 (CEST)", "from mail-pj1-f68.google.com (mail-pj1-f68.google.com\n [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 2483B1C0AD\n for <dev@dpdk.org>; Tue, 1 Sep 2020 18:56:53 +0200 (CEST)", "by mail-pj1-f68.google.com with SMTP id n3so882334pjq.1\n for <dev@dpdk.org>; Tue, 01 Sep 2020 09:56:52 -0700 (PDT)", "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n by smtp.gmail.com with ESMTPSA id b203sm2266499pfb.205.2020.09.01.09.56.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 01 Sep 2020 09:56:50 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=NfFGSb4KaPgrkOeGHqgadUeGmnE6LrZ+W1ZCEVONgi4=;\n b=LGAOx42nEhZjg3r33NkrmWCakXftc4q91GLjk8AOss8lfAzNTqWJjBaFNuNwQgfu9o\n TFyYPquv8QUrpRGdeA9YWNt0sOfehkWuc0lC7lxmk1+DBnlObvj/rNjRic1ds13bF1v8\n sptygdbmENgDj4lrYWppMBw5w/mhzORWzMWU6QZk47noQim0wawodJ5SLXm+VgtVHbdw\n DTZWxAY1Tg8pFzeodmP7Wp4QhkMPoA/BBOlA2Zmv2QyUFo77rYhBZG6E1FEJxgFng1BI\n 58DgsdxP+R8E2xen2POn0RxUSBLLRem+GntTM1Sa4HOp8rDmlBneB93gzsabi/WmDjQ3\n FCgQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=NfFGSb4KaPgrkOeGHqgadUeGmnE6LrZ+W1ZCEVONgi4=;\n b=uJ2cxjR7/tTexsIILysKVoX+NWYTsZUQx3FsfdoJHPNMNX82o+swpKnsd5IUuNpiwR\n J8zXmHf8Z5GRJQKbyRV21PwDYegy0MbIpHIfGOvb5jlHN62y8jiCDbpFjgtmTQCKLUPO\n tfySvEqQLG4HMyA9KwJbrEpGsuqeJWe8WITmeSQf2aUfSYy0ENoLXZmMicIxEqb3FzKA\n 3MV+VW9PAay2kJ5JLBtcjzeUHWfKwhjzWKAKpQ3ztw3LJ4vdk8JouoG1ggG0886TWxQn\n UXA+9a3TXDn7b7fqkwHzp7E0j6l0JT9Iip2+oqWDDCL2n8PmMecamJQ9R2w+1BqNwXht\n U+Ng==", "X-Gm-Message-State": "AOAM532MLrve0VfrsFv71VhrQ+bS4pWHw/YoUsCHdUVBPvajvd01Fnve\n PCJvm9dd+WfvJoBMhNESATpgUKM3DKBsOw==", "X-Google-Smtp-Source": "\n ABdhPJwUp6x2vn1mEcdYFHKqidXqYpBs4NMLqRg/bALFDmr58QC9goV7Zf9Kvr4PijP+uajS/UokpA==", "X-Received": "by 2002:a17:902:7c01:: with SMTP id\n x1mr2247255pll.34.1598979411280;\n Tue, 01 Sep 2020 09:56:51 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "dev@dpdk.org", "Cc": "Stephen Hemminger <stephen@networkplumber.org>", "Date": "Tue, 1 Sep 2020 09:56:43 -0700", "Message-Id": "<20200901165643.15668-1-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<2173565.OSGeAx7z5R@thomas>", "References": "<2173565.OSGeAx7z5R@thomas>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH] usertools: add huge page setup script", "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This is an improved version of the setup of huge pages\nbases on earlier DPDK setup. Differences are:\n * it autodetects NUMA vs non NUMA\n * it allows setting different page sizes\n recent kernels support multiple sizes.\n * it accepts a parameter in bytes (not pages).\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\nThis is lightly tested, it still needs testing on multiple architectures\netc.\n\n usertools/hugepage-setup.sh | 169 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 169 insertions(+)\n create mode 100755 usertools/hugepage-setup.sh", "diff": "diff --git a/usertools/hugepage-setup.sh b/usertools/hugepage-setup.sh\nnew file mode 100755\nindex 000000000000..df132e2f8d64\n--- /dev/null\n+++ b/usertools/hugepage-setup.sh\n@@ -0,0 +1,169 @@\n+#! /bin/bash\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2010-2014 Intel Corporation\n+#\n+\n+usage()\n+{\n+ echo \"Usage: $0 size [pagesize]\"\n+ echo \" size is in bytes with optional M or G suffix\"\n+ echo \" pagesize is the pagesize to use\"\n+ exit 1\n+}\n+\n+get_pagesize()\n+{\n+ SIZE=\"$1\"\n+\n+ if [[ \"$SIZE\" =~ ^[0-9]+G$ ]]; then\n+\techo $((${SIZE%%G} * 1024 * 1024))\n+ elif [[ \"$SIZE\" =~ ^[0-9]+M$ ]]; then\n+\techo $((${SIZE%%M} * 1024))\n+ elif [[ \"$SIZE\" =~ ^[0-9]+K$ ]]; then\n+\techo ${SIZE%%K}\n+ elif [[ \"$SIZE\" =~ ^[0-9]+$ ]]; then\n+\tif [ $((SIZE % 1024)) -ne 0 ]; then\n+\t exit 1\n+\telse\n+\t echo $((SIZE / 1024))\n+\tfi\n+ else\n+\texit 1\n+ fi\n+}\n+\n+#\n+# Creates hugepage filesystem.\n+#\n+create_mnt_huge()\n+{\n+ echo \"Creating /mnt/huge and mounting as hugetlbfs\"\n+ mkdir -p /mnt/huge\n+\n+ grep -s '/mnt/huge' /proc/mounts > /dev/null\n+ if [ $? -ne 0 ] ; then\n+\tmount -t hugetlbfs -o pagesize=${PAGESIZE} nodev /mnt/huge\n+ fi\n+}\n+\n+#\n+# Removes hugepage filesystem.\n+#\n+remove_mnt_huge()\n+{\n+ echo \"Unmounting /mnt/huge and removing directory\"\n+ grep -s '/mnt/huge' /proc/mounts > /dev/null\n+ if [ $? -eq 0 ] ; then\n+\tumount /mnt/huge\n+ fi\n+\n+ if [ -d /mnt/huge ] ; then\n+\trm -R /mnt/huge\n+ fi\n+}\n+#\n+# Removes all reserved hugepages.\n+#\n+clear_huge_pages()\n+{\n+ echo > .echo_tmp\n+ for d in /sys/devices/system/node/node? ; do\n+\tfor sz in $d/hugepages/hugepages-* ; do\n+\t echo \"echo 0 > ${sz}/nr_hugepages\" >> .echo_tmp\n+\tdone\n+ done\n+ echo \"Removing currently reserved hugepages\"\n+ sh .echo_tmp\n+ rm -f .echo_tmp\n+\n+ remove_mnt_huge\n+}\n+\n+#\n+# Creates hugepages.\n+#\n+set_non_numa_pages()\n+{\n+ path=/sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}kB\n+ if [ ! -d $path ]; then\n+\t>&2 echo \"${HUGEPGSZ}K is not a valid huge page size\"\n+\texit 1\n+ fi\n+ for sz in /sys/kernel/mm/hugepages/hugepages-* ; do\n+\techo \"echo 0 > ${sz}/nr_hugepages\" >> .echo_tmp\n+ done\n+\n+ echo \"Reserving $PAGES hugepages of size $HUGEPGSZ kB\"\n+ echo $PAGES > $path/nr_hugepages\n+\n+ create_mnt_huge\n+}\n+\n+#\n+# Creates hugepages on specific NUMA nodes.\n+#\n+set_numa_pages()\n+{\n+\tclear_huge_pages\n+\n+\techo > .echo_tmp\n+\tfor d in /sys/devices/system/node/node? ; do\n+\t\tnode=$(basename $d)\n+\t\tpath=\"$d/hugepages/hugepages-${HUGEPGSZ}kB\"\n+\t\tif [ ! -d $path ]; then\n+\t\t >&2 echo \"${HUGEPGSZ}K is not a valid huge page size\"\n+\t\t exit 1\n+\t\tfi\n+\n+\t\techo \"echo $Pages > $path\" >> .echo_tmp\n+\tdone\n+\techo \"Reserving $PAGES hugepages of size $HUGEPGSZ kB (numa)\"\n+\tsh .echo_tmp\n+\trm -f .echo_tmp\n+\n+\tcreate_mnt_huge\n+}\n+\n+#\n+# Need size argument\n+#\n+[ $# -ge 1 ] || usage\n+\n+#\n+# Convert from size to pages\n+#\n+KSIZE=$(get_pagesize $1)\n+if [ $? -ne 0 ]; then\n+ >&2 echo \"Invalid huge area size: $1\"\n+ exit 1\n+fi\n+\n+#\n+# Optional second argument is pagesize\n+#\n+if [ $# -gt 1 ]; then\n+ HUGEPGSZ=$(get_pagesize $2)\n+ if [ $? -ne 0 ]; then\n+\t>&2 echo \"Invalid huge page size: $2\"\n+\texit 1\n+ fi\n+else\n+ HUGEPGSZ=$(awk '/^Hugepagesize/ { print $2 }' /proc/meminfo )\n+fi\n+\n+if [ $((KSIZE % HUGEPGSZ)) -ne 0 ] ; then\n+ echo \"Invalid number of huge pages $KSIZE K, should be multiple of $HUGEPGSZ K\"\n+ exit 1\n+fi\n+\n+PAGES=$((KSIZE / HUGEPGSZ))\n+PAGESIZE=$((HUGEPGSZ * 1024))\n+\n+#\n+# Do NUMA if necessary\n+#\n+if [ -e /sys/devices/numa/node ]; then\n+ set_numa_pages\n+else\n+ set_non_numa_pages\n+fi\n", "prefixes": [] }{ "id": 76268, "url": "