get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 6000,
    "url": "https://patches.dpdk.org/api/patches/6000/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1435741430-2088-1-git-send-email-zoltan.kiss@linaro.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": "<1435741430-2088-1-git-send-email-zoltan.kiss@linaro.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1435741430-2088-1-git-send-email-zoltan.kiss@linaro.org",
    "date": "2015-07-01T09:03:50",
    "name": "[dpdk-dev,v2] mempool: improve cache search",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e4125f5c1ea57ef88b975f3995e012fe98127c7a",
    "submitter": {
        "id": 202,
        "url": "https://patches.dpdk.org/api/people/202/?format=api",
        "name": "Zoltan Kiss",
        "email": "zoltan.kiss@linaro.org"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1435741430-2088-1-git-send-email-zoltan.kiss@linaro.org/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/6000/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/6000/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 B0DDB5A9A;\n\tWed,  1 Jul 2015 11:04:04 +0200 (CEST)",
            "from mail-wi0-f172.google.com (mail-wi0-f172.google.com\n\t[209.85.212.172]) by dpdk.org (Postfix) with ESMTP id DA36358F1\n\tfor <dev@dpdk.org>; Wed,  1 Jul 2015 11:04:02 +0200 (CEST)",
            "by wiwl6 with SMTP id l6so157959393wiw.0\n\tfor <dev@dpdk.org>; Wed, 01 Jul 2015 02:04:02 -0700 (PDT)",
            "from localhost.localdomain ([90.152.119.35])\n\tby mx.google.com with ESMTPSA id\n\tp2sm2368418wix.11.2015.07.01.02.04.01\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 01 Jul 2015 02:04:01 -0700 (PDT)"
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=YT7hjoFlp59LK0QNifdobzESJqfUrHLk16ATflcDwEs=;\n\tb=dUzlU3iT5xVvzGI60ddTrIeDY3/pONcCOpxvhuyFbcaITZGYl1dKSOVv6uyfpymjNA\n\twy6EV9CGw1AQVWaedBTjiiBwuIh/jk56OYZVqNVARyjYkvQr7ER3atLX8nn+nBe9Au0C\n\t0iqZLGVoAkCQAq0kC3RHyuZw3DTtbpNPM4r1gB1qbQRu+Gbh2shGi/f7qpLF+oLlYu/V\n\tupFuw+a9mvaUWZ7aZMqvXU5Y7NbSfdy4W0kO6MQcxFg0dGG5nPB34pbi5TIHUk94TS8c\n\twzW87VsyRlXjMoVgGJGJ5NQjK8f2NxHhYGgcPm4oD4bdmCXooFkF8i/6N8pPPRk6RR3b\n\tKe2g==",
        "X-Gm-Message-State": "ALoCoQkFXb1D0QvBMatqABth9y5XZiZIsSL1V84KYS2Q5JeYQN/rESIFeb4wB+WRajo95pHbG8z/",
        "X-Received": "by 10.194.110.100 with SMTP id hz4mr47494229wjb.6.1435741442753; \n\tWed, 01 Jul 2015 02:04:02 -0700 (PDT)",
        "From": "Zoltan Kiss <zoltan.kiss@linaro.org>",
        "To": "dev@dpdk.org",
        "Date": "Wed,  1 Jul 2015 10:03:50 +0100",
        "Message-Id": "<1435741430-2088-1-git-send-email-zoltan.kiss@linaro.org>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1435258110-17140-1-git-send-email-zoltan.kiss@linaro.org>",
        "References": "<1435258110-17140-1-git-send-email-zoltan.kiss@linaro.org>",
        "Subject": "[dpdk-dev] [PATCH v2] mempool: improve cache search",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "The current way has a few problems:\n\n- if cache->len < n, we copy our elements into the cache first, then\n  into obj_table, that's unnecessary\n- if n >= cache_size (or the backfill fails), and we can't fulfil the\n  request from the ring alone, we don't try to combine with the cache\n- if refill fails, we don't return anything, even if the ring has enough\n  for our request\n\nThis patch rewrites it severely:\n- at the first part of the function we only try the cache if cache->len < n\n- otherwise take our elements straight from the ring\n- if that fails but we have something in the cache, try to combine them\n- the refill happens at the end, and its failure doesn't modify our return\n  value\n\nSigned-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>\n---\nv2:\n- fix subject\n- add unlikely for branch where request is fulfilled both from cache and ring\n\n lib/librte_mempool/rte_mempool.h | 63 +++++++++++++++++++++++++---------------\n 1 file changed, 39 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h\nindex 6d4ce9a..1e96f03 100644\n--- a/lib/librte_mempool/rte_mempool.h\n+++ b/lib/librte_mempool/rte_mempool.h\n@@ -947,34 +947,14 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table,\n \tunsigned lcore_id = rte_lcore_id();\n \tuint32_t cache_size = mp->cache_size;\n \n-\t/* cache is not enabled or single consumer */\n+\tcache = &mp->local_cache[lcore_id];\n+\t/* cache is not enabled or single consumer or not enough */\n \tif (unlikely(cache_size == 0 || is_mc == 0 ||\n-\t\t     n >= cache_size || lcore_id >= RTE_MAX_LCORE))\n+\t\t     cache->len < n || lcore_id >= RTE_MAX_LCORE))\n \t\tgoto ring_dequeue;\n \n-\tcache = &mp->local_cache[lcore_id];\n \tcache_objs = cache->objs;\n \n-\t/* Can this be satisfied from the cache? */\n-\tif (cache->len < n) {\n-\t\t/* No. Backfill the cache first, and then fill from it */\n-\t\tuint32_t req = n + (cache_size - cache->len);\n-\n-\t\t/* How many do we require i.e. number to fill the cache + the request */\n-\t\tret = rte_ring_mc_dequeue_bulk(mp->ring, &cache->objs[cache->len], req);\n-\t\tif (unlikely(ret < 0)) {\n-\t\t\t/*\n-\t\t\t * In the offchance that we are buffer constrained,\n-\t\t\t * where we are not able to allocate cache + n, go to\n-\t\t\t * the ring directly. If that fails, we are truly out of\n-\t\t\t * buffers.\n-\t\t\t */\n-\t\t\tgoto ring_dequeue;\n-\t\t}\n-\n-\t\tcache->len += req;\n-\t}\n-\n \t/* Now fill in the response ... */\n \tfor (index = 0, len = cache->len - 1; index < n; ++index, len--, obj_table++)\n \t\t*obj_table = cache_objs[len];\n@@ -983,7 +963,8 @@ __mempool_get_bulk(struct rte_mempool *mp, void **obj_table,\n \n \t__MEMPOOL_STAT_ADD(mp, get_success, n);\n \n-\treturn 0;\n+\tret = 0;\n+\tgoto cache_refill;\n \n ring_dequeue:\n #endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */\n@@ -994,11 +975,45 @@ ring_dequeue:\n \telse\n \t\tret = rte_ring_sc_dequeue_bulk(mp->ring, obj_table, n);\n \n+#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0\n+\tif (unlikely(ret < 0 && is_mc == 1 && cache->len > 0)) {\n+\t\tuint32_t req = n - cache->len;\n+\n+\t\tret = rte_ring_mc_dequeue_bulk(mp->ring, obj_table, req);\n+\t\tif (ret == 0) {\n+\t\t\tcache_objs = cache->objs;\n+\t\t\tobj_table += req;\n+\t\t\tfor (index = 0; index < cache->len;\n+\t\t\t     ++index, ++obj_table)\n+\t\t\t\t*obj_table = cache_objs[index];\n+\t\t\tcache->len = 0;\n+\t\t}\n+\t}\n+#endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */\n+\n \tif (ret < 0)\n \t\t__MEMPOOL_STAT_ADD(mp, get_fail, n);\n \telse\n \t\t__MEMPOOL_STAT_ADD(mp, get_success, n);\n \n+#if RTE_MEMPOOL_CACHE_MAX_SIZE > 0\n+cache_refill:\n+\t/* If previous dequeue was OK and we have less than n, start refill */\n+\tif (ret == 0 && cache_size > 0 && cache->len < n) {\n+\t\tuint32_t req = cache_size - cache->len;\n+\n+\t\tcache_objs = cache->objs;\n+\t\tret = rte_ring_mc_dequeue_bulk(mp->ring,\n+\t\t\t\t\t       &cache->objs[cache->len],\n+\t\t\t\t\t       req);\n+\t\tif (likely(ret == 0))\n+\t\t\tcache->len += req;\n+\t\telse\n+\t\t\t/* Don't spoil the return value */\n+\t\t\tret = 0;\n+\t}\n+#endif /* RTE_MEMPOOL_CACHE_MAX_SIZE > 0 */\n+\n \treturn ret;\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "v2"
    ]
}