get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 20648,
    "url": "http://patches.dpdk.org/api/patches/20648/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20170221142530.31472-1-matthias.gatto@outscale.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": "<20170221142530.31472-1-matthias.gatto@outscale.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170221142530.31472-1-matthias.gatto@outscale.com",
    "date": "2017-02-21T14:25:30",
    "name": "[dpdk-dev] vhost: try to shrink pfdset when fdset_add fails",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2b8ca0334cb19f16d15e94b4562858518573f545",
    "submitter": {
        "id": 555,
        "url": "http://patches.dpdk.org/api/people/555/?format=api",
        "name": "Matthias Gatto",
        "email": "matthias.gatto@outscale.com"
    },
    "delegate": {
        "id": 355,
        "url": "http://patches.dpdk.org/api/users/355/?format=api",
        "username": "yliu",
        "first_name": "Yuanhan",
        "last_name": "Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20170221142530.31472-1-matthias.gatto@outscale.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/20648/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/20648/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 F055D2A5E;\n\tTue, 21 Feb 2017 15:25:50 +0100 (CET)",
            "from dv-adm01.admin\n\t(ows-185-21-195-233.eu-west-1.compute.outscale.com [185.21.195.233])\n\tby dpdk.org (Postfix) with ESMTP id 10C26952\n\tfor <dev@dpdk.org>; Tue, 21 Feb 2017 15:25:49 +0100 (CET)",
            "from localhost.localdomain (unknown [172.19.166.138])\n\tby dv-adm01.admin (Postfix) with ESMTP id 70D7C40319;\n\tTue, 21 Feb 2017 14:25:49 +0000 (UTC)"
        ],
        "From": "Matthias Gatto <matthias.gatto@outscale.com>",
        "To": "dev@dpdk.org",
        "Cc": "Matthias Gatto <matthias.gatto@outscale.com>, yuanhan.liu@linux.intel.com",
        "Date": "Tue, 21 Feb 2017 15:25:30 +0100",
        "Message-Id": "<20170221142530.31472-1-matthias.gatto@outscale.com>",
        "X-Mailer": "git-send-email 2.10.0",
        "Subject": "[dpdk-dev] [PATCH] vhost: try to shrink pfdset when fdset_add fails",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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": "fdset_add increment pfdset->num, but fdset_del doesn't decrement pfdset->num,\nso if we call fdset_add then fdset_del in a loop witout calling\nfdset_shrink, we can easily exceed MAX_FDS with only a few number of fds\nused.\n\nSo my solution is simply to call fdset_shrink in fdset_add\nwhen it exceed MAX_FDS.\n\nBecause fdset_shrink and fdset_add locks pfdset->fd_mutex we can't call\nfdset_shrink inside fdset_add because that would cause a dead lock,\nso this patch split fdset_shrink in two, fdset_shrink amd fdset_shrink_nolock.\n\nSigned-off-by: Matthias Gatto <matthias.gatto@outscale.com>\n---\n lib/librte_vhost/fd_man.c | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c\nindex 8a075da..c7a4490 100644\n--- a/lib/librte_vhost/fd_man.c\n+++ b/lib/librte_vhost/fd_man.c\n@@ -65,17 +65,12 @@ fdset_move(struct fdset *pfdset, int dst, int src)\n \tpfdset->rwfds[dst] = pfdset->rwfds[src];\n }\n \n-/*\n- * Find deleted fd entries and remove them\n- */\n static void\n-fdset_shrink(struct fdset *pfdset)\n+fdset_shrink_nolock(struct fdset *pfdset)\n {\n \tint i;\n \tint last_valid_idx = get_last_valid_idx(pfdset, pfdset->num - 1);\n \n-\tpthread_mutex_lock(&pfdset->fd_mutex);\n-\n \tfor (i = 0; i < last_valid_idx; i++) {\n \t\tif (pfdset->fd[i].fd != -1)\n \t\t\tcontinue;\n@@ -84,7 +79,16 @@ fdset_shrink(struct fdset *pfdset)\n \t\tlast_valid_idx = get_last_valid_idx(pfdset, last_valid_idx - 1);\n \t}\n \tpfdset->num = last_valid_idx + 1;\n+}\n \n+/*\n+ * Find deleted fd entries and remove them\n+ */\n+static void\n+fdset_shrink(struct fdset *pfdset)\n+{\n+\tpthread_mutex_lock(&pfdset->fd_mutex);\n+\tfdset_shrink_nolock(pfdset);\n \tpthread_mutex_unlock(&pfdset->fd_mutex);\n }\n \n@@ -151,8 +155,12 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)\n \tpthread_mutex_lock(&pfdset->fd_mutex);\n \ti = pfdset->num < MAX_FDS ? pfdset->num++ : -1;\n \tif (i == -1) {\n-\t\tpthread_mutex_unlock(&pfdset->fd_mutex);\n-\t\treturn -2;\n+\t\tfdset_shrink_nolock(pfdset);\n+\t\ti = pfdset->num < MAX_FDS ? pfdset->num++ : -1;\n+\t\tif (i == -1) {\n+\t\t\tpthread_mutex_unlock(&pfdset->fd_mutex);\n+\t\t\treturn -2;\n+\t\t}\n \t}\n \n \tfdset_add_fd(pfdset, i, fd, rcb, wcb, dat);\n",
    "prefixes": [
        "dpdk-dev"
    ]
}