get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 130972,
    "url": "http://patchwork.dpdk.org/api/patches/130972/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230831111937.60975-1-changfengnan@bytedance.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20230831111937.60975-1-changfengnan@bytedance.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230831111937.60975-1-changfengnan@bytedance.com",
    "date": "2023-08-31T11:19:37",
    "name": "[RFC] move memset out of hold lock when rte_free",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9fd7197b40f4110a7f3afce369294517a26ba2b5",
    "submitter": {
        "id": 2894,
        "url": "http://patchwork.dpdk.org/api/people/2894/?format=api",
        "name": "Fengnan Chang",
        "email": "changfengnan@bytedance.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230831111937.60975-1-changfengnan@bytedance.com/mbox/",
    "series": [
        {
            "id": 29387,
            "url": "http://patchwork.dpdk.org/api/series/29387/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29387",
            "date": "2023-08-31T11:19:37",
            "name": "[RFC] move memset out of hold lock when rte_free",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/29387/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/130972/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/130972/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 0CB5A41FDB;\n\tThu, 31 Aug 2023 13:19:47 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DF33E4027B;\n\tThu, 31 Aug 2023 13:19:46 +0200 (CEST)",
            "from mail-pj1-f46.google.com (mail-pj1-f46.google.com\n [209.85.216.46]) by mails.dpdk.org (Postfix) with ESMTP id 08B3C40279\n for <dev@dpdk.org>; Thu, 31 Aug 2023 13:19:44 +0200 (CEST)",
            "by mail-pj1-f46.google.com with SMTP id\n 98e67ed59e1d1-26fd9ac0260so76496a91.0\n for <dev@dpdk.org>; Thu, 31 Aug 2023 04:19:44 -0700 (PDT)",
            "from HTW5T2C6VL.bytedance.net ([203.208.167.146])\n by smtp.gmail.com with ESMTPSA id\n u3-20020a17090282c300b001c0ce518e98sm1041036plz.224.2023.08.31.04.19.41\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Thu, 31 Aug 2023 04:19:43 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=bytedance.com; s=google; t=1693480784; x=1694085584; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=b8cHdyFuAFW6GuzuBtm1DJ9MMKiPawWw4kU+ITIALxc=;\n b=ax29EC7gpxgyE3dCI9hqIb7Jny/d+RCjfkKXiCmmkXNH7CYyWkVrPibX4rw9BXezn+\n kwjvTY87QY+5cOb6vzdfK9uunHowrzMZ7w4BkCGuhYwCURXCqmOypmMBDOhd24+cv8Z9\n h+GmWMCRgqpWN8ueXo84axspVbCFbE6Pp8pVDHaCqDMcWApGyH8fJVe+qcxxct4G3YjT\n uVIn+AbXWWP3mbSoDQjiqn6qfrRDPN4vlI1wg8tSxY7qEZiTTgcn65QmdY1hkMzUluVz\n emF6rS+dUZrYM/qIpC6weRgdg3JsrHHm+LmOf6x9jluL6YNUDQcnLU9Cq1N6hvezNqHh\n +vpA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20221208; t=1693480784; x=1694085584;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=b8cHdyFuAFW6GuzuBtm1DJ9MMKiPawWw4kU+ITIALxc=;\n b=TS8pUlqH+xZyqkxTUn7Wm4mnPRF/VnNk0Xlp9O7PXN70fB+WGfI/TLA0a185A1OduG\n OBDJ7ydhXKdlDG1xbidPFV9GpRbCocTxEXTFY9gNg1BVQGHWYaC9Fz/Q8z8jRHKRDRMx\n wLpGMPx2jRsaLz0Xzub7hs43JccZH35rC5L3+b5hBtQZtPzFzafNetEW2LMZkQFYs+Pf\n r7ifrkqBV/E5gX0VMYgZubhi1s3HJjqVholGNpUMGtzN5dnecBTe3dgmJI7Nvot7r5JS\n ApJaMtmLkAbzouSWM8gUs7UFmW/5AXpHQNPbWHZP88fClyWfZNHsDbLsqihq3iMYI/+E\n 4zRg==",
        "X-Gm-Message-State": "AOJu0YyPZnFVfRdpBj/YXpQNALp4yRhZ7Zxd7594MejH67s6UHkx9eFv\n 9DPCC2XHCQQaG9VKvpt+UWxWxg==",
        "X-Google-Smtp-Source": "\n AGHT+IFAABX4tOBh9GkkGnNL/1GFHfKWWA4o3pIAU+cAfkkYovTQrU3s8o2pB2H0wqcyv9RUN2kUqA==",
        "X-Received": "by 2002:a17:90a:4e47:b0:26d:412c:fc3c with SMTP id\n t7-20020a17090a4e4700b0026d412cfc3cmr4460563pjl.3.1693480783902;\n Thu, 31 Aug 2023 04:19:43 -0700 (PDT)",
        "From": "Fengnan Chang <changfengnan@bytedance.com>",
        "To": "anatoly.burakov@intel.com,\n\tdev@dpdk.org,\n\tdkozlyuk@nvidia.com",
        "Cc": "Fengnan Chang <changfengnan@bytedance.com>",
        "Subject": "[RFC PATCH] move memset out of hold lock when rte_free",
        "Date": "Thu, 31 Aug 2023 19:19:37 +0800",
        "Message-Id": "<20230831111937.60975-1-changfengnan@bytedance.com>",
        "X-Mailer": "git-send-email 2.37.1 (Apple Git-137.1)",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "In rte_free, the most cost time part of the whole process is\nmemset, we can do memset without hold heap->lock, the benefit\nis reduce lock contention when multi thread try alloc or free.\n\nIn my test with 40 cores machine, I add some code to account\nwhole function cost in test_align_overlap_per_lcore with different\nalloc/size, under legacy memory mode without existing hugepage,\nfiles, this is test result:\n\nsize    w/      w/o\n64      119us   118us\n128     124us   118us\n1024    137us   127us\n4096    137us   140us\n8192    142us   158us\n16384   138us   186us\n65536   139us   375us\n131072  133us   627us\n524277  694us   2973us\n1048576 2117us  7685us\n\nSigned-off-by: Fengnan Chang <changfengnan@bytedance.com>\n---\n lib/eal/common/malloc_elem.c | 16 ----------------\n lib/eal/common/malloc_heap.c | 26 ++++++++++++++++++++++++--\n 2 files changed, 24 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c\nindex 35a2313d04..763bbe179b 100644\n--- a/lib/eal/common/malloc_elem.c\n+++ b/lib/eal/common/malloc_elem.c\n@@ -569,12 +569,6 @@ malloc_elem_join_adjacent_free(struct malloc_elem *elem)\n struct malloc_elem *\n malloc_elem_free(struct malloc_elem *elem)\n {\n-\tvoid *ptr;\n-\tsize_t data_len;\n-\n-\tptr = RTE_PTR_ADD(elem, MALLOC_ELEM_HEADER_LEN);\n-\tdata_len = elem->size - MALLOC_ELEM_OVERHEAD;\n-\n \t/*\n \t * Consider the element clean for the purposes of joining.\n \t * If both neighbors are clean or non-existent,\n@@ -591,16 +585,6 @@ malloc_elem_free(struct malloc_elem *elem)\n \n \t/* decrease heap's count of allocated elements */\n \telem->heap->alloc_count--;\n-\n-#ifndef RTE_MALLOC_DEBUG\n-\t/* Normally clear the memory when needed. */\n-\tif (!elem->dirty)\n-\t\tmemset(ptr, 0, data_len);\n-#else\n-\t/* Always poison the memory in debug mode. */\n-\tmemset(ptr, MALLOC_POISON, data_len);\n-#endif\n-\n \treturn elem;\n }\n \ndiff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c\nindex d25bdc98f9..a5fdc4cc6f 100644\n--- a/lib/eal/common/malloc_heap.c\n+++ b/lib/eal/common/malloc_heap.c\n@@ -862,6 +862,8 @@ malloc_heap_free(struct malloc_elem *elem)\n \tunsigned int i, n_segs, before_space, after_space;\n \tint ret;\n \tbool unmapped = false;\n+\tvoid *ptr;\n+\tsize_t data_len;\n \tconst struct internal_config *internal_conf =\n \t\teal_get_internal_configuration();\n \n@@ -875,16 +877,36 @@ malloc_heap_free(struct malloc_elem *elem)\n \tmsl = elem->msl;\n \tpage_sz = (size_t)msl->page_sz;\n \n-\trte_spinlock_lock(&(heap->lock));\n-\n \tvoid *asan_ptr = RTE_PTR_ADD(elem, MALLOC_ELEM_HEADER_LEN + elem->pad);\n \tsize_t asan_data_len = elem->size - MALLOC_ELEM_OVERHEAD - elem->pad;\n \n+\tptr = RTE_PTR_ADD(elem, MALLOC_ELEM_HEADER_LEN);\n+\tdata_len = elem->size - MALLOC_ELEM_OVERHEAD;\n+\n+\t/* If orig_elem is clean, any child elem should be clean, so let's do memset\n+\t * before hold lock.\n+\t */\n+\tif (internal_conf->legacy_mem && !elem->orig_elem->dirty)\n+\t\tmemset(ptr, 0, data_len);\n+\n+\trte_spinlock_lock(&(heap->lock));\n \t/* mark element as free */\n \telem->state = ELEM_FREE;\n \n \telem = malloc_elem_free(elem);\n \n+#ifndef RTE_MALLOC_DEBUG\n+\tif (internal_conf->legacy_mem) {\n+\t\t/* If orig_elem is dirty, the joint element is clean, we need do memset now */\n+\t\tif (elem->orig_elem->dirty && !elem->dirty)\n+\t\t\tmemset(ptr, 0, data_len);\n+\t} else if (!elem->dirty) {\n+\t\tmemset(ptr, 0, data_len);\n+\t}\n+#else\n+\t/* Always poison the memory in debug mode. */\n+\tmemset(ptr, MALLOC_POISON, data_len);\n+#endif\n \t/* anything after this is a bonus */\n \tret = 0;\n \n",
    "prefixes": [
        "RFC"
    ]
}