get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/32464/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 32464,
    "url": "https://patches.dpdk.org/api/patches/32464/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/ac6a76546782694fb41b0de3dfcf6ef23de71541.1513681966.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": "<ac6a76546782694fb41b0de3dfcf6ef23de71541.1513681966.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/ac6a76546782694fb41b0de3dfcf6ef23de71541.1513681966.git.anatoly.burakov@intel.com",
    "date": "2017-12-19T11:14:37",
    "name": "[dpdk-dev,RFC,v2,10/23] eal: read hugepage counts from node-specific sysfs path",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a3fb2fa8319088fe70ee6c268c6abf6186f6abda",
    "submitter": {
        "id": 4,
        "url": "https://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/ac6a76546782694fb41b0de3dfcf6ef23de71541.1513681966.git.anatoly.burakov@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/32464/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/32464/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 C16B31B1CD;\n\tTue, 19 Dec 2017 12:15:17 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 4B6A11B01F\n\tfor <dev@dpdk.org>; Tue, 19 Dec 2017 12:14:56 +0100 (CET)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2017 03:14:54 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga006.jf.intel.com with ESMTP; 19 Dec 2017 03:14:52 -0800",
            "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\tvBJBEqVT003113; Tue, 19 Dec 2017 11:14:52 GMT",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id vBJBEqGF010245;\n\tTue, 19 Dec 2017 11:14:52 GMT",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id vBJBEqTQ010240;\n\tTue, 19 Dec 2017 11:14:52 GMT"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.45,426,1508828400\"; d=\"scan'208\";a=\"4054827\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "andras.kovacs@ericsson.com, laszlo.vadkeri@ericsson.com,\n\tkeith.wiles@intel.com, benjamin.walker@intel.com,\n\tbruce.richardson@intel.com, thomas@monjalon.net",
        "Date": "Tue, 19 Dec 2017 11:14:37 +0000",
        "Message-Id": "<ac6a76546782694fb41b0de3dfcf6ef23de71541.1513681966.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1513681966.git.anatoly.burakov@intel.com>",
            "<cover.1513681966.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1513681966.git.anatoly.burakov@intel.com>",
            "<cover.1513681966.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [RFC v2 10/23] eal: read hugepage counts from\n\tnode-specific sysfs path",
        "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": "For non-legacy memory init mode, instead of looking at generic\nsysfs path, look at sysfs paths pertaining to each NUMA node\nfor hugepage counts. Note that per-NUMA node path does not\nprovide information regarding reserved pages, so we might not\nget the best info from these paths, but this saves us from the\nwhole mapping/remapping business before we're actually able to\ntell which page is on which socket, because we no longer require\nour memory to be physically contiguous.\n\nLegacy memory init will not use this.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 73 +++++++++++++++++++++++--\n 1 file changed, 67 insertions(+), 6 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 86e174f..a85c15a 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c\n@@ -59,6 +59,7 @@\n #include \"eal_filesystem.h\"\n \n static const char sys_dir_path[] = \"/sys/kernel/mm/hugepages\";\n+static const char sys_pages_numa_dir_path[] = \"/sys/devices/system/node\";\n \n /* this function is only called from eal_hugepage_info_init which itself\n  * is only called from a primary process */\n@@ -99,6 +100,42 @@ get_num_hugepages(const char *subdir)\n \treturn num_pages;\n }\n \n+static uint32_t\n+get_num_hugepages_on_node(const char *subdir, unsigned socket) {\n+\tchar path[PATH_MAX], socketpath[PATH_MAX];\n+\tDIR *socketdir;\n+\tlong unsigned num_pages = 0;\n+\tconst char *nr_hp_file = \"free_hugepages\";\n+\n+\tsnprintf(socketpath, sizeof(socketpath), \"%s/node%u/hugepages\",\n+\t\t sys_pages_numa_dir_path, socket);\n+\n+\tsocketdir = opendir(socketpath);\n+\tif (socketdir) {\n+\t\t/* Keep calm and carry on */\n+\t\tclosedir(socketdir);\n+\t} else {\n+\t\t/* Can't find socket dir, so ignore it */\n+\t\treturn 0;\n+\t}\n+\n+\tsnprintf(path, sizeof(path), \"%s/%s/%s\",\n+\t\t\tsocketpath, subdir, nr_hp_file);\n+\tif (eal_parse_sysfs_value(path, &num_pages) < 0)\n+\t\treturn 0;\n+\n+\tif (num_pages == 0)\n+\t\tRTE_LOG(WARNING, EAL, \"No free hugepages reported in %s\\n\",\n+\t\t\t\tsubdir);\n+\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 get_default_hp_size(void)\n {\n@@ -277,7 +314,7 @@ eal_hugepage_info_init(void)\n {\n \tconst char dirent_start_text[] = \"hugepages-\";\n \tconst size_t dirent_start_len = sizeof(dirent_start_text) - 1;\n-\tunsigned i, num_sizes = 0;\n+\tunsigned i, total_pages, num_sizes = 0;\n \tDIR *dir;\n \tstruct dirent *dirent;\n \n@@ -331,9 +368,24 @@ eal_hugepage_info_init(void)\n \t\tif (clear_hugedir(hpi->hugedir) == -1)\n \t\t\tbreak;\n \n-\t\t/* for now, put all pages into socket 0,\n-\t\t * later they will be sorted */\n-\t\thpi->num_pages[0] = get_num_hugepages(dirent->d_name);\n+\t\t/* first, try to put all hugepages into relevant sockets, but\n+\t\t * if first attempts fails, fall back to collecting all pages\n+\t\t * in one socket and sorting them later */\n+\t\ttotal_pages = 0;\n+\t\t/* we also don't want to do this for legacy init */\n+\t\tif (!internal_config.legacy_mem)\n+\t\t\tfor (i = 0; i < rte_num_sockets(); i++) {\n+\t\t\t\tunsigned num_pages =\n+\t\t\t\t\t\tget_num_hugepages_on_node(\n+\t\t\t\t\t\t\tdirent->d_name, i);\n+\t\t\t\thpi->num_pages[i] = num_pages;\n+\t\t\t\ttotal_pages += num_pages;\n+\t\t\t}\n+\t\t/* we failed to sort memory from the get go, so fall\n+\t\t * back to old way */\n+\t\tif (total_pages == 0) {\n+\t\t\thpi->num_pages[0] = get_num_hugepages(dirent->d_name);\n+\t\t}\n \n #ifndef RTE_ARCH_64\n \t\t/* for 32-bit systems, limit number of hugepages to\n@@ -357,10 +409,19 @@ eal_hugepage_info_init(void)\n \t      sizeof(internal_config.hugepage_info[0]), compare_hpi);\n \n \t/* now we have all info, check we have at least one valid size */\n-\tfor (i = 0; i < num_sizes; i++)\n+\tfor (i = 0; i < num_sizes; i++) {\n+\t\t/* pages may no longer all be on socket 0, so check all */\n+\t\tunsigned j, num_pages = 0;\n+\n+\t\tfor (j = 0; j < RTE_MAX_NUMA_NODES; j++) {\n+\t\t\tstruct hugepage_info *hpi =\n+\t\t\t\t\t&internal_config.hugepage_info[i];\n+\t\t\tnum_pages += hpi->num_pages[j];\n+\t\t}\n \t\tif (internal_config.hugepage_info[i].hugedir != NULL &&\n-\t\t    internal_config.hugepage_info[i].num_pages[0] > 0)\n+\t\t\t\tnum_pages > 0)\n \t\t\treturn 0;\n+\t}\n \n \t/* no valid hugepage mounts available, return error */\n \treturn -1;\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "v2",
        "10/23"
    ]
}