get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 47608,
    "url": "http://patches.dpdk.org/api/patches/47608/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1540981587-88590-3-git-send-email-gavin.hu@arm.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": "<1540981587-88590-3-git-send-email-gavin.hu@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1540981587-88590-3-git-send-email-gavin.hu@arm.com",
    "date": "2018-10-31T10:26:27",
    "name": "[v3,2/2] ring: move the atomic load of head above the loop",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8cd5e398a06d8f31404139118eb0ba301464d315",
    "submitter": {
        "id": 1018,
        "url": "http://patches.dpdk.org/api/people/1018/?format=api",
        "name": "Gavin Hu",
        "email": "gavin.hu@arm.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/1540981587-88590-3-git-send-email-gavin.hu@arm.com/mbox/",
    "series": [
        {
            "id": 2175,
            "url": "http://patches.dpdk.org/api/series/2175/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2175",
            "date": "2018-10-31T10:26:25",
            "name": "ring library with c11 memory model bug fix and optimization",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/2175/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/47608/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/47608/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 24DF74F94;\n\tWed, 31 Oct 2018 11:26:52 +0100 (CET)",
            "from foss.arm.com (foss.arm.com [217.140.101.70])\n\tby dpdk.org (Postfix) with ESMTP id 94753324D;\n\tWed, 31 Oct 2018 11:26:44 +0100 (CET)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D1117341;\n\tWed, 31 Oct 2018 03:26:43 -0700 (PDT)",
            "from net-arm-thunderx2.shanghai.arm.com\n\t(net-arm-thunderx2.shanghai.arm.com [10.169.40.70])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id\n\t190603F71D; Wed, 31 Oct 2018 03:26:41 -0700 (PDT)"
        ],
        "From": "Gavin Hu <gavin.hu@arm.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, olivier.matz@6wind.com, chaozhu@linux.vnet.ibm.com, \n\tbruce.richardson@intel.com, konstantin.ananyev@intel.com,\n\tjerin.jacob@caviumnetworks.com, Honnappa.Nagarahalli@arm.com,\n\tgavin.hu@arm.com, stable@dpdk.org",
        "Date": "Wed, 31 Oct 2018 18:26:27 +0800",
        "Message-Id": "<1540981587-88590-3-git-send-email-gavin.hu@arm.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": [
            "<1540981587-88590-1-git-send-email-gavin.hu@arm.com>",
            "<1540956945-211373-1-git-send-email-gavin.hu@arm.com>"
        ],
        "References": [
            "<1540981587-88590-1-git-send-email-gavin.hu@arm.com>",
            "<1540956945-211373-1-git-send-email-gavin.hu@arm.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v3 2/2] ring: move the atomic load of head above\n\tthe loop",
        "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": "In __rte_ring_move_prod_head, move the __atomic_load_n up and out of\nthe do {} while loop as upon failure the old_head will be updated,\nanother load is costly and not necessary.\n\nThis helps a little on the latency,about 1~5%.\n\n Test result with the patch(two cores):\n SP/SC bulk enq/dequeue (size: 8): 5.64\n MP/MC bulk enq/dequeue (size: 8): 9.58\n SP/SC bulk enq/dequeue (size: 32): 1.98\n MP/MC bulk enq/dequeue (size: 32): 2.30\n\nFixes: 39368ebfc606 (\"ring: introduce C11 memory model barrier option\")\nCc: stable@dpdk.org\n\nSigned-off-by: Gavin Hu <gavin.hu@arm.com>\nReviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>\nReviewed-by: Steve Capper <steve.capper@arm.com>\nReviewed-by: Ola Liljedahl <Ola.Liljedahl@arm.com>\nReviewed-by: Jia He <justin.he@arm.com>\nAcked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>\nTested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>\n---\n doc/guides/rel_notes/release_18_11.rst |  7 +++++++\n lib/librte_ring/rte_ring_c11_mem.h     | 10 ++++------\n 2 files changed, 11 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst\nindex 376128f..c9c2b86 100644\n--- a/doc/guides/rel_notes/release_18_11.rst\n+++ b/doc/guides/rel_notes/release_18_11.rst\n@@ -69,6 +69,13 @@ New Features\n   checked out against that dma mask and rejected if out of range. If more than\n   one device has addressing limitations, the dma mask is the more restricted one.\n \n+* **Updated the ring library with C11 memory model.**\n+\n+  Updated the ring library with C11 memory model including the following changes:\n+\n+  * Synchronize the load and store of the tail\n+  * Move the atomic load of head above the loop\n+\n * **Added hot-unplug handle mechanism.**\n \n   ``rte_dev_hotplug_handle_enable`` and ``rte_dev_hotplug_handle_disable`` are\ndiff --git a/lib/librte_ring/rte_ring_c11_mem.h b/lib/librte_ring/rte_ring_c11_mem.h\nindex 4851763..fdab2b9 100644\n--- a/lib/librte_ring/rte_ring_c11_mem.h\n+++ b/lib/librte_ring/rte_ring_c11_mem.h\n@@ -60,13 +60,11 @@ __rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,\n \tunsigned int max = n;\n \tint success;\n \n+\t*old_head = __atomic_load_n(&r->prod.head, __ATOMIC_ACQUIRE);\n \tdo {\n \t\t/* Reset n to the initial burst count */\n \t\tn = max;\n \n-\t\t*old_head = __atomic_load_n(&r->prod.head,\n-\t\t\t\t\t__ATOMIC_ACQUIRE);\n-\n \t\t/* load-acquire synchronize with store-release of ht->tail\n \t\t * in update_tail.\n \t\t */\n@@ -92,6 +90,7 @@ __rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,\n \t\tif (is_sp)\n \t\t\tr->prod.head = *new_head, success = 1;\n \t\telse\n+\t\t\t/* on failure, *old_head is updated */\n \t\t\tsuccess = __atomic_compare_exchange_n(&r->prod.head,\n \t\t\t\t\told_head, *new_head,\n \t\t\t\t\t0, __ATOMIC_ACQUIRE,\n@@ -133,13 +132,11 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,\n \tint success;\n \n \t/* move cons.head atomically */\n+\t*old_head = __atomic_load_n(&r->cons.head, __ATOMIC_ACQUIRE);\n \tdo {\n \t\t/* Restore n as it may change every loop */\n \t\tn = max;\n \n-\t\t*old_head = __atomic_load_n(&r->cons.head,\n-\t\t\t\t\t__ATOMIC_ACQUIRE);\n-\n \t\t/* this load-acquire synchronize with store-release of ht->tail\n \t\t * in update_tail.\n \t\t */\n@@ -164,6 +161,7 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,\n \t\tif (is_sc)\n \t\t\tr->cons.head = *new_head, success = 1;\n \t\telse\n+\t\t\t/* on failure, *old_head will be updated */\n \t\t\tsuccess = __atomic_compare_exchange_n(&r->cons.head,\n \t\t\t\t\t\t\told_head, *new_head,\n \t\t\t\t\t\t\t0, __ATOMIC_ACQUIRE,\n",
    "prefixes": [
        "v3",
        "2/2"
    ]
}