get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44266,
    "url": "http://patches.dpdk.org/api/patches/44266/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/50837ea5ba781e6ec382d7159a1fcb83b8e5e124.1536072550.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": "<50837ea5ba781e6ec382d7159a1fcb83b8e5e124.1536072550.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/50837ea5ba781e6ec382d7159a1fcb83b8e5e124.1536072550.git.anatoly.burakov@intel.com",
    "date": "2018-09-04T15:01:57",
    "name": "[v2,4/9] memalloc: rename lock list to fd list",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "57258b627840a1ccd3c8665c90d68eca1bcbba1f",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/50837ea5ba781e6ec382d7159a1fcb83b8e5e124.1536072550.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 1176,
            "url": "http://patches.dpdk.org/api/series/1176/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1176",
            "date": "2018-09-04T15:01:53",
            "name": "Improve running DPDK without hugetlbfs mounpoint",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/1176/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44266/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/44266/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 ABE762BF3;\n\tTue,  4 Sep 2018 17:02:09 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 3BB14231E\n\tfor <dev@dpdk.org>; Tue,  4 Sep 2018 17:02:06 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Sep 2018 08:02:05 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga008.jf.intel.com with ESMTP; 04 Sep 2018 08:02:03 -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\tw84F23GX020005; Tue, 4 Sep 2018 16:02:03 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w84F231A008567;\n\tTue, 4 Sep 2018 16:02:03 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w84F23F6008562;\n\tTue, 4 Sep 2018 16:02:03 +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,329,1531810800\"; d=\"scan'208\";a=\"70479496\"",
        "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": "Tue,  4 Sep 2018 16:01:57 +0100",
        "Message-Id": "<50837ea5ba781e6ec382d7159a1fcb83b8e5e124.1536072550.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1536072550.git.anatoly.burakov@intel.com>",
            "<cover.1536072550.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1536072550.git.anatoly.burakov@intel.com>",
            "<cover.1535041359.git.anatoly.burakov@intel.com>\n\t<cover.1536072550.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v2 4/9] memalloc: rename lock list to fd list",
        "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 using lock lists to store per-page lock fd's\nbecause we cannot use modern fcntl() file description locks to lock\nparts of the page in single file segments mode.\n\nNow, we will be using this list to store either lock fd's (along with\nmemseg list fd) in single file segments mode, or per-page fd's (and set\nmemseg list fd to -1), so rename the list accordingly.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/linuxapp/eal/eal_memalloc.c | 66 ++++++++++++----------\n 1 file changed, 37 insertions(+), 29 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\nindex aa95551a8..14bc5dce9 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c\n@@ -57,25 +57,33 @@ const int anonymous_hugepages_supported =\n  */\n static int fallocate_supported = -1; /* unknown */\n \n-/* for single-file segments, we need some kind of mechanism to keep track of\n+/*\n+ * we have two modes - single file segments, and file-per-page mode.\n+ *\n+ * for single-file segments, we need some kind of mechanism to keep track of\n  * which hugepages can be freed back to the system, and which cannot. we cannot\n  * use flock() because they don't allow locking parts of a file, and we cannot\n  * use fcntl() due to issues with their semantics, so we will have to rely on a\n- * bunch of lockfiles for each page.\n+ * bunch of lockfiles for each page. so, we will use 'fds' array to keep track\n+ * of per-page lockfiles. we will store the actual segment list fd in the\n+ * 'memseg_list_fd' field.\n+ *\n+ * for file-per-page mode, each page will have its own fd, so 'memseg_list_fd'\n+ * will be invalid (set to -1), and we'll use 'fds' to keep track of page fd's.\n  *\n  * we cannot know how many pages a system will have in advance, but we do know\n  * that they come in lists, and we know lengths of these lists. so, simply store\n  * a malloc'd array of fd's indexed by list and segment index.\n  *\n  * they will be initialized at startup, and filled as we allocate/deallocate\n- * segments. also, use this to track memseg list proper fd.\n+ * segments.\n  */\n static struct {\n \tint *fds; /**< dynamically allocated array of segment lock fd's */\n \tint memseg_list_fd; /**< memseg list fd */\n \tint len; /**< total length of the array */\n \tint count; /**< entries used in an array */\n-} lock_fds[RTE_MAX_MEMSEG_LISTS];\n+} fd_list[RTE_MAX_MEMSEG_LISTS];\n \n /** local copy of a memory map, used to synchronize memory hotplug in MP */\n static struct rte_memseg_list local_memsegs[RTE_MAX_MEMSEG_LISTS];\n@@ -209,12 +217,12 @@ static int get_segment_lock_fd(int list_idx, int seg_idx)\n \tchar path[PATH_MAX] = {0};\n \tint fd;\n \n-\tif (list_idx < 0 || list_idx >= (int)RTE_DIM(lock_fds))\n+\tif (list_idx < 0 || list_idx >= (int)RTE_DIM(fd_list))\n \t\treturn -1;\n-\tif (seg_idx < 0 || seg_idx >= lock_fds[list_idx].len)\n+\tif (seg_idx < 0 || seg_idx >= fd_list[list_idx].len)\n \t\treturn -1;\n \n-\tfd = lock_fds[list_idx].fds[seg_idx];\n+\tfd = fd_list[list_idx].fds[seg_idx];\n \t/* does this lock already exist? */\n \tif (fd >= 0)\n \t\treturn fd;\n@@ -236,8 +244,8 @@ static int get_segment_lock_fd(int list_idx, int seg_idx)\n \t\treturn -1;\n \t}\n \t/* store it for future reference */\n-\tlock_fds[list_idx].fds[seg_idx] = fd;\n-\tlock_fds[list_idx].count++;\n+\tfd_list[list_idx].fds[seg_idx] = fd;\n+\tfd_list[list_idx].count++;\n \treturn fd;\n }\n \n@@ -245,12 +253,12 @@ static int unlock_segment(int list_idx, int seg_idx)\n {\n \tint fd, ret;\n \n-\tif (list_idx < 0 || list_idx >= (int)RTE_DIM(lock_fds))\n+\tif (list_idx < 0 || list_idx >= (int)RTE_DIM(fd_list))\n \t\treturn -1;\n-\tif (seg_idx < 0 || seg_idx >= lock_fds[list_idx].len)\n+\tif (seg_idx < 0 || seg_idx >= fd_list[list_idx].len)\n \t\treturn -1;\n \n-\tfd = lock_fds[list_idx].fds[seg_idx];\n+\tfd = fd_list[list_idx].fds[seg_idx];\n \n \t/* upgrade lock to exclusive to see if we can remove the lockfile */\n \tret = lock(fd, LOCK_EX);\n@@ -270,8 +278,8 @@ static int unlock_segment(int list_idx, int seg_idx)\n \t * and remove it from list anyway.\n \t */\n \tclose(fd);\n-\tlock_fds[list_idx].fds[seg_idx] = -1;\n-\tlock_fds[list_idx].count--;\n+\tfd_list[list_idx].fds[seg_idx] = -1;\n+\tfd_list[list_idx].count--;\n \n \tif (ret < 0)\n \t\treturn -1;\n@@ -288,7 +296,7 @@ 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, list_idx);\n \n-\t\tfd = lock_fds[list_idx].memseg_list_fd;\n+\t\tfd = fd_list[list_idx].memseg_list_fd;\n \n \t\tif (fd < 0) {\n \t\t\tfd = open(path, O_CREAT | O_RDWR, 0600);\n@@ -304,7 +312,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,\n \t\t\t\tclose(fd);\n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tlock_fds[list_idx].memseg_list_fd = fd;\n+\t\t\tfd_list[list_idx].memseg_list_fd = fd;\n \t\t}\n \t} else {\n \t\t/* create a hugepage file path */\n@@ -410,9 +418,9 @@ resize_hugefile(int fd, char *path, int list_idx, int seg_idx,\n \t\t\t\t * page file fd, so that one of the processes\n \t\t\t\t * could then delete the file after shrinking.\n \t\t\t\t */\n-\t\t\t\tif (ret < 1 && lock_fds[list_idx].count == 0) {\n+\t\t\t\tif (ret < 1 && fd_list[list_idx].count == 0) {\n \t\t\t\t\tclose(fd);\n-\t\t\t\t\tlock_fds[list_idx].memseg_list_fd = -1;\n+\t\t\t\t\tfd_list[list_idx].memseg_list_fd = -1;\n \t\t\t\t}\n \n \t\t\t\tif (ret < 0) {\n@@ -448,13 +456,13 @@ resize_hugefile(int fd, char *path, int list_idx, int seg_idx,\n \t\t\t\t * more segments active in this segment list,\n \t\t\t\t * and remove the file if there aren't.\n \t\t\t\t */\n-\t\t\t\tif (lock_fds[list_idx].count == 0) {\n+\t\t\t\tif (fd_list[list_idx].count == 0) {\n \t\t\t\t\tif (unlink(path))\n \t\t\t\t\t\tRTE_LOG(ERR, EAL, \"%s(): unlinking '%s' failed: %s\\n\",\n \t\t\t\t\t\t\t__func__, path,\n \t\t\t\t\t\t\tstrerror(errno));\n \t\t\t\t\tclose(fd);\n-\t\t\t\t\tlock_fds[list_idx].memseg_list_fd = -1;\n+\t\t\t\t\tfd_list[list_idx].memseg_list_fd = -1;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n@@ -1319,7 +1327,7 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,\n }\n \n static int\n-secondary_lock_list_create_walk(const struct rte_memseg_list *msl,\n+fd_list_create_walk(const struct rte_memseg_list *msl,\n \t\tvoid *arg __rte_unused)\n {\n \tstruct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n@@ -1330,20 +1338,20 @@ secondary_lock_list_create_walk(const struct rte_memseg_list *msl,\n \tmsl_idx = msl - mcfg->memsegs;\n \tlen = msl->memseg_arr.len;\n \n-\t/* ensure we have space to store lock fd per each possible segment */\n+\t/* ensure we have space to store fd per each possible segment */\n \tdata = malloc(sizeof(int) * len);\n \tif (data == NULL) {\n-\t\tRTE_LOG(ERR, EAL, \"Unable to allocate space for lock descriptors\\n\");\n+\t\tRTE_LOG(ERR, EAL, \"Unable to allocate space for file descriptors\\n\");\n \t\treturn -1;\n \t}\n \t/* set all fd's as invalid */\n \tfor (i = 0; i < len; i++)\n \t\tdata[i] = -1;\n \n-\tlock_fds[msl_idx].fds = data;\n-\tlock_fds[msl_idx].len = len;\n-\tlock_fds[msl_idx].count = 0;\n-\tlock_fds[msl_idx].memseg_list_fd = -1;\n+\tfd_list[msl_idx].fds = data;\n+\tfd_list[msl_idx].len = len;\n+\tfd_list[msl_idx].count = 0;\n+\tfd_list[msl_idx].memseg_list_fd = -1;\n \n \treturn 0;\n }\n@@ -1355,9 +1363,9 @@ eal_memalloc_init(void)\n \t\tif (rte_memseg_list_walk(secondary_msl_create_walk, NULL) < 0)\n \t\t\treturn -1;\n \n-\t/* initialize all of the lock fd lists */\n+\t/* initialize all of the fd lists */\n \tif (internal_config.single_file_segments)\n-\t\tif (rte_memseg_list_walk(secondary_lock_list_create_walk, NULL))\n+\t\tif (rte_memseg_list_walk(fd_list_create_walk, NULL))\n \t\t\treturn -1;\n \treturn 0;\n }\n",
    "prefixes": [
        "v2",
        "4/9"
    ]
}