get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43838,
    "url": "http://patches.dpdk.org/api/patches/43838/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/9f751dd73551c6e2e22beea95b0ec751e36e06ab.1535041359.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<9f751dd73551c6e2e22beea95b0ec751e36e06ab.1535041359.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/9f751dd73551c6e2e22beea95b0ec751e36e06ab.1535041359.git.anatoly.burakov@intel.com",
    "date": "2018-08-23T16:59:52",
    "name": "[5/8] memalloc: track page fd's in non-single file mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fe0b21d0223d266452ccd7e17a78eaf716ee509e",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/9f751dd73551c6e2e22beea95b0ec751e36e06ab.1535041359.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 1040,
            "url": "http://patches.dpdk.org/api/series/1040/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1040",
            "date": "2018-08-23T16:59:47",
            "name": "Improve running DPDK without hugetlbfs mounpoint",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1040/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43838/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43838/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 B469D4F9C;\n\tThu, 23 Aug 2018 19:00:09 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id 5B0B14C96\n\tfor <dev@dpdk.org>; Thu, 23 Aug 2018 19:00:00 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t23 Aug 2018 09:59:58 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga007.fm.intel.com with ESMTP; 23 Aug 2018 09:59:56 -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\tw7NGxuPA025439; Thu, 23 Aug 2018 17:59:56 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w7NGxuU8006719;\n\tThu, 23 Aug 2018 17:59:56 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w7NGxuVB006715;\n\tThu, 23 Aug 2018 17:59:56 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,278,1531810800\"; d=\"scan'208\";a=\"64676728\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "tiwei.bie@intel.com, ray.kinsella@intel.com, zhihong.wang@intel.com,\n\tmaxime.coquelin@redhat.com, kuralamudhan.ramakrishnan@intel.com",
        "Date": "Thu, 23 Aug 2018 17:59:52 +0100",
        "Message-Id": "<9f751dd73551c6e2e22beea95b0ec751e36e06ab.1535041359.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1535041359.git.anatoly.burakov@intel.com>",
            "<cover.1535041359.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1535041359.git.anatoly.burakov@intel.com>",
            "<cover.1535041359.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH 5/8] memalloc: track page fd's in non-single file\n\tmode",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Previously, we were only tracking lock file fd's in single-file\nsegments mode, but did not track fd's in non-single file mode\nbecause we didn't need to (mmap() call still kept the lock). Now\nthat we are going to expose these fd's to the world, we need to\nhave access to them, so track them even in non-single file\nsegments mode.\n\nWe don't need to close fd's after mmap() because we're still\ntracking them in an fd list. Also, for anonymous hugepages mode,\nfd will always be -1 so exit early on error.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/linuxapp/eal/eal_memalloc.c | 44 ++++++++++++----------\n 1 file changed, 25 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\nindex 14bc5dce9..7d536350e 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n@@ -318,18 +318,24 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,\n \t\t/* create a hugepage file path */\n \t\teal_get_hugefile_path(path, buflen, hi->hugedir,\n \t\t\t\tlist_idx * RTE_MAX_MEMSEG_PER_LIST + seg_idx);\n-\t\tfd = open(path, O_CREAT | O_RDWR, 0600);\n+\n+\t\tfd = fd_list[list_idx].fds[seg_idx];\n+\n \t\tif (fd < 0) {\n-\t\t\tRTE_LOG(DEBUG, EAL, \"%s(): open failed: %s\\n\", __func__,\n-\t\t\t\t\tstrerror(errno));\n-\t\t\treturn -1;\n-\t\t}\n-\t\t/* take out a read lock */\n-\t\tif (lock(fd, LOCK_SH) < 0) {\n-\t\t\tRTE_LOG(ERR, EAL, \"%s(): lock failed: %s\\n\",\n-\t\t\t\t__func__, strerror(errno));\n-\t\t\tclose(fd);\n-\t\t\treturn -1;\n+\t\t\tfd = open(path, O_CREAT | O_RDWR, 0600);\n+\t\t\tif (fd < 0) {\n+\t\t\t\tRTE_LOG(DEBUG, EAL, \"%s(): open failed: %s\\n\",\n+\t\t\t\t\t__func__, strerror(errno));\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\t/* take out a read lock */\n+\t\t\tif (lock(fd, LOCK_SH) < 0) {\n+\t\t\t\tRTE_LOG(ERR, EAL, \"%s(): lock failed: %s\\n\",\n+\t\t\t\t\t__func__, strerror(errno));\n+\t\t\t\tclose(fd);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t\tfd_list[list_idx].fds[seg_idx] = fd;\n \t\t}\n \t}\n \treturn fd;\n@@ -601,10 +607,6 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,\n \t\tgoto mapped;\n \t}\n #endif\n-\t/* for non-single file segments that aren't in-memory, we can close fd\n-\t * here */\n-\tif (!internal_config.single_file_segments && !internal_config.in_memory)\n-\t\tclose(fd);\n \n \tms->addr = addr;\n \tms->hugepage_sz = alloc_sz;\n@@ -634,7 +636,10 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,\n \t\tRTE_LOG(CRIT, EAL, \"Can't mmap holes in our virtual address space\\n\");\n \t}\n resized:\n-\t/* in-memory mode will never be single-file-segments mode */\n+\t/* some codepaths will return negative fd, so exit early */\n+\tif (fd < 0)\n+\t\treturn -1;\n+\n \tif (internal_config.single_file_segments) {\n \t\tresize_hugefile(fd, path, list_idx, seg_idx, map_offset,\n \t\t\t\talloc_sz, false);\n@@ -646,6 +651,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,\n \t\t\t\tlock(fd, LOCK_EX) == 1)\n \t\t\tunlink(path);\n \t\tclose(fd);\n+\t\tfd_list[list_idx].fds[seg_idx] = -1;\n \t}\n \treturn -1;\n }\n@@ -700,6 +706,7 @@ free_seg(struct rte_memseg *ms, struct hugepage_info *hi,\n \t\t}\n \t\t/* closing fd will drop the lock */\n \t\tclose(fd);\n+\t\tfd_list[list_idx].fds[seg_idx] = -1;\n \t}\n \n \tmemset(ms, 0, sizeof(*ms));\n@@ -1364,8 +1371,7 @@ eal_memalloc_init(void)\n \t\t\treturn -1;\n \n \t/* initialize all of the fd lists */\n-\tif (internal_config.single_file_segments)\n-\t\tif (rte_memseg_list_walk(fd_list_create_walk, NULL))\n-\t\t\treturn -1;\n+\tif (rte_memseg_list_walk(fd_list_create_walk, NULL))\n+\t\treturn -1;\n \treturn 0;\n }\n",
    "prefixes": [
        "5/8"
    ]
}