get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 137808,
    "url": "http://patches.dpdk.org/api/patches/137808/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240302200408.6419-1-mb@smartsharesystems.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": "<20240302200408.6419-1-mb@smartsharesystems.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240302200408.6419-1-mb@smartsharesystems.com",
    "date": "2024-03-02T20:04:08",
    "name": "[v7] mempool: test performance with larger bursts",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "fb20e91407f2f58e680c1ada0550dba5be28c73b",
    "submitter": {
        "id": 591,
        "url": "http://patches.dpdk.org/api/people/591/?format=api",
        "name": "Morten Brørup",
        "email": "mb@smartsharesystems.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/20240302200408.6419-1-mb@smartsharesystems.com/mbox/",
    "series": [
        {
            "id": 31346,
            "url": "http://patches.dpdk.org/api/series/31346/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31346",
            "date": "2024-03-02T20:04:08",
            "name": "[v7] mempool: test performance with larger bursts",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/31346/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/137808/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/137808/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 B362243BCD;\n\tSat,  2 Mar 2024 21:04:11 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 69D1A42EEE;\n\tSat,  2 Mar 2024 21:04:11 +0100 (CET)",
            "from dkmailrelay1.smartsharesystems.com\n (smartserver.smartsharesystems.com [77.243.40.215])\n by mails.dpdk.org (Postfix) with ESMTP id 7A89140271\n for <dev@dpdk.org>; Sat,  2 Mar 2024 21:04:10 +0100 (CET)",
            "from smartserver.smartsharesystems.com\n (smartserver.smartsharesys.local [192.168.4.10])\n by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 4889A20CF1;\n Sat,  2 Mar 2024 21:04:10 +0100 (CET)",
            "from dkrd2.smartsharesys.local ([192.168.4.12]) by\n smartserver.smartsharesystems.com with Microsoft SMTPSVC(6.0.3790.4675);\n Sat, 2 Mar 2024 21:04:09 +0100"
        ],
        "From": "=?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>",
        "To": "andrew.rybchenko@oktetlabs.ru, fengchengwen@huawei.com,\n thomas@monjalon.net, honnappa.nagarahalli@arm.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>",
        "Subject": "[PATCH v7] mempool: test performance with larger bursts",
        "Date": "Sat,  2 Mar 2024 21:04:08 +0100",
        "Message-Id": "<20240302200408.6419-1-mb@smartsharesystems.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20240121045249.22465-1-mb@smartsharesystems.com>",
        "References": "<20240121045249.22465-1-mb@smartsharesystems.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-OriginalArrivalTime": "02 Mar 2024 20:04:09.0979 (UTC)\n FILETIME=[CA1464B0:01DA6CDC]",
        "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": "Bursts of up to 64, 128 and 256 packets are not uncommon, so increase the\nmaximum tested get and put burst sizes from 32 to 256.\nFor convenience, also test get and put burst sizes of\nRTE_MEMPOOL_CACHE_MAX_SIZE.\n\nSome applications keep more than 512 objects, so increase the maximum\nnumber of kept objects from 512 to 32768, still in jumps of factor four.\nThis exceeds the typical mempool cache size of 512 objects, so the test\nalso exercises the mempool driver.\n\nIncreased the precision of rate_persec calculation by timing the actual\nduration of the test, instead of assuming it took exactly 5 seconds.\n\nAdded cache guard to per-lcore stats structure.\n\nSigned-off-by: Morten Brørup <mb@smartsharesystems.com>\nAcked-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n\nv7:\n* Increase max burst size to 256. (Inspired by Honnappa)\nv6:\n* Do not test with more lcores than available. (Thomas)\nv5:\n* Increased N, to reduce measurement overhead with large numbers of kept\n  objects.\n* Increased precision of rate_persec calculation.\n* Added missing cache guard to per-lcore stats structure.\nv4:\n* v3 failed to apply; I had messed up something with git.\n* Added ACK from Chengwen Feng.\nv3:\n* Increased max number of kept objects to 32768.\n* Added get and put burst sizes of RTE_MEMPOOL_CACHE_MAX_SIZE objects.\n* Print error if unable to allocate mempool.\n* Initialize use_external_cache with each test.\n  A previous version of this patch had a bug, where all test runs\n  following the first would use external cache. (Chengwen Feng)\nv2: Addressed feedback by Chengwen Feng\n* Added get and put burst sizes of 64 objects, which is probably also not\n  uncommon packet burst size.\n* Fixed list of number of kept objects so list remains in jumps of factor\n  four.\n* Added three derivative test cases, for faster testing.\n---\n app/test/test_mempool_perf.c | 144 +++++++++++++++++++++++------------\n 1 file changed, 96 insertions(+), 48 deletions(-)",
    "diff": "diff --git a/app/test/test_mempool_perf.c b/app/test/test_mempool_perf.c\nindex 96de347f04..bb40d1d911 100644\n--- a/app/test/test_mempool_perf.c\n+++ b/app/test/test_mempool_perf.c\n@@ -54,22 +54,25 @@\n  *\n  *    - Bulk size (*n_get_bulk*, *n_put_bulk*)\n  *\n- *      - Bulk get from 1 to 32\n- *      - Bulk put from 1 to 32\n- *      - Bulk get and put from 1 to 32, compile time constant\n+ *      - Bulk get from 1 to 256, and RTE_MEMPOOL_CACHE_MAX_SIZE\n+ *      - Bulk put from 1 to 256, and RTE_MEMPOOL_CACHE_MAX_SIZE\n+ *      - Bulk get and put from 1 to 256, and RTE_MEMPOOL_CACHE_MAX_SIZE, compile time constant\n  *\n  *    - Number of kept objects (*n_keep*)\n  *\n  *      - 32\n  *      - 128\n  *      - 512\n+ *      - 2048\n+ *      - 8192\n+ *      - 32768\n  */\n \n-#define N 65536\n #define TIME_S 5\n #define MEMPOOL_ELT_SIZE 2048\n-#define MAX_KEEP 512\n-#define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE))-1)\n+#define MAX_KEEP 32768\n+#define N (128 * MAX_KEEP)\n+#define MEMPOOL_SIZE ((rte_lcore_count()*(MAX_KEEP+RTE_MEMPOOL_CACHE_MAX_SIZE*2))-1)\n \n /* Number of pointers fitting into one cache line. */\n #define CACHE_LINE_BURST (RTE_CACHE_LINE_SIZE / sizeof(uintptr_t))\n@@ -100,9 +103,11 @@ static unsigned n_keep;\n /* true if we want to test with constant n_get_bulk and n_put_bulk */\n static int use_constant_values;\n \n-/* number of enqueues / dequeues */\n+/* number of enqueues / dequeues, and time used */\n struct mempool_test_stats {\n \tuint64_t enq_count;\n+\tuint64_t duration_cycles;\n+\tRTE_CACHE_GUARD;\n } __rte_cache_aligned;\n \n static struct mempool_test_stats stats[RTE_MAX_LCORE];\n@@ -185,6 +190,7 @@ per_lcore_mempool_test(void *arg)\n \t\tGOTO_ERR(ret, out);\n \n \tstats[lcore_id].enq_count = 0;\n+\tstats[lcore_id].duration_cycles = 0;\n \n \t/* wait synchro for workers */\n \tif (lcore_id != rte_get_main_lcore())\n@@ -204,6 +210,15 @@ per_lcore_mempool_test(void *arg)\n \t\t\t\t\tCACHE_LINE_BURST, CACHE_LINE_BURST);\n \t\telse if (n_get_bulk == 32)\n \t\t\tret = test_loop(mp, cache, n_keep, 32, 32);\n+\t\telse if (n_get_bulk == 64)\n+\t\t\tret = test_loop(mp, cache, n_keep, 64, 64);\n+\t\telse if (n_get_bulk == 128)\n+\t\t\tret = test_loop(mp, cache, n_keep, 128, 128);\n+\t\telse if (n_get_bulk == 256)\n+\t\t\tret = test_loop(mp, cache, n_keep, 256, 256);\n+\t\telse if (n_get_bulk == RTE_MEMPOOL_CACHE_MAX_SIZE)\n+\t\t\tret = test_loop(mp, cache, n_keep,\n+\t\t\t\t\tRTE_MEMPOOL_CACHE_MAX_SIZE, RTE_MEMPOOL_CACHE_MAX_SIZE);\n \t\telse\n \t\t\tret = -1;\n \n@@ -215,6 +230,8 @@ per_lcore_mempool_test(void *arg)\n \t\tstats[lcore_id].enq_count += N;\n \t}\n \n+\tstats[lcore_id].duration_cycles = time_diff;\n+\n out:\n \tif (use_external_cache) {\n \t\trte_mempool_cache_flush(cache, mp);\n@@ -232,6 +249,7 @@ launch_cores(struct rte_mempool *mp, unsigned int cores)\n \tuint64_t rate;\n \tint ret;\n \tunsigned cores_save = cores;\n+\tdouble hz = rte_get_timer_hz();\n \n \t__atomic_store_n(&synchro, 0, __ATOMIC_RELAXED);\n \n@@ -278,7 +296,9 @@ launch_cores(struct rte_mempool *mp, unsigned int cores)\n \n \trate = 0;\n \tfor (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)\n-\t\trate += (stats[lcore_id].enq_count / TIME_S);\n+\t\tif (stats[lcore_id].duration_cycles != 0)\n+\t\t\trate += (double)stats[lcore_id].enq_count * hz /\n+\t\t\t\t\t(double)stats[lcore_id].duration_cycles;\n \n \tprintf(\"rate_persec=%\" PRIu64 \"\\n\", rate);\n \n@@ -287,11 +307,13 @@ launch_cores(struct rte_mempool *mp, unsigned int cores)\n \n /* for a given number of core, launch all test cases */\n static int\n-do_one_mempool_test(struct rte_mempool *mp, unsigned int cores)\n+do_one_mempool_test(struct rte_mempool *mp, unsigned int cores, int external_cache)\n {\n-\tunsigned int bulk_tab_get[] = { 1, 4, CACHE_LINE_BURST, 32, 0 };\n-\tunsigned int bulk_tab_put[] = { 1, 4, CACHE_LINE_BURST, 32, 0 };\n-\tunsigned int keep_tab[] = { 32, 128, 512, 0 };\n+\tunsigned int bulk_tab_get[] = { 1, 4, CACHE_LINE_BURST, 32, 64, 128, 256,\n+\t\t\tRTE_MEMPOOL_CACHE_MAX_SIZE, 0 };\n+\tunsigned int bulk_tab_put[] = { 1, 4, CACHE_LINE_BURST, 32, 64, 128, 256,\n+\t\t\tRTE_MEMPOOL_CACHE_MAX_SIZE, 0 };\n+\tunsigned int keep_tab[] = { 32, 128, 512, 2048, 8192, 32768, 0 };\n \tunsigned *get_bulk_ptr;\n \tunsigned *put_bulk_ptr;\n \tunsigned *keep_ptr;\n@@ -301,6 +323,10 @@ do_one_mempool_test(struct rte_mempool *mp, unsigned int cores)\n \t\tfor (put_bulk_ptr = bulk_tab_put; *put_bulk_ptr; put_bulk_ptr++) {\n \t\t\tfor (keep_ptr = keep_tab; *keep_ptr; keep_ptr++) {\n \n+\t\t\t\tif (*keep_ptr < *get_bulk_ptr || *keep_ptr < *put_bulk_ptr)\n+\t\t\t\t\tcontinue;\n+\n+\t\t\t\tuse_external_cache = external_cache;\n \t\t\t\tuse_constant_values = 0;\n \t\t\t\tn_get_bulk = *get_bulk_ptr;\n \t\t\t\tn_put_bulk = *put_bulk_ptr;\n@@ -323,7 +349,7 @@ do_one_mempool_test(struct rte_mempool *mp, unsigned int cores)\n }\n \n static int\n-test_mempool_perf(void)\n+do_all_mempool_perf_tests(unsigned int cores)\n {\n \tstruct rte_mempool *mp_cache = NULL;\n \tstruct rte_mempool *mp_nocache = NULL;\n@@ -337,8 +363,10 @@ test_mempool_perf(void)\n \t\t\t\t\tNULL, NULL,\n \t\t\t\t\tmy_obj_init, NULL,\n \t\t\t\t\tSOCKET_ID_ANY, 0);\n-\tif (mp_nocache == NULL)\n+\tif (mp_nocache == NULL) {\n+\t\tprintf(\"cannot allocate mempool (without cache)\\n\");\n \t\tgoto err;\n+\t}\n \n \t/* create a mempool (with cache) */\n \tmp_cache = rte_mempool_create(\"perf_test_cache\", MEMPOOL_SIZE,\n@@ -347,8 +375,10 @@ test_mempool_perf(void)\n \t\t\t\t      NULL, NULL,\n \t\t\t\t      my_obj_init, NULL,\n \t\t\t\t      SOCKET_ID_ANY, 0);\n-\tif (mp_cache == NULL)\n+\tif (mp_cache == NULL) {\n+\t\tprintf(\"cannot allocate mempool (with cache)\\n\");\n \t\tgoto err;\n+\t}\n \n \tdefault_pool_ops = rte_mbuf_best_mempool_ops();\n \t/* Create a mempool based on Default handler */\n@@ -376,65 +406,83 @@ test_mempool_perf(void)\n \n \trte_mempool_obj_iter(default_pool, my_obj_init, NULL);\n \n-\t/* performance test with 1, 2 and max cores */\n \tprintf(\"start performance test (without cache)\\n\");\n-\n-\tif (do_one_mempool_test(mp_nocache, 1) < 0)\n-\t\tgoto err;\n-\n-\tif (do_one_mempool_test(mp_nocache, 2) < 0)\n+\tif (do_one_mempool_test(mp_nocache, cores, 0) < 0)\n \t\tgoto err;\n \n-\tif (do_one_mempool_test(mp_nocache, rte_lcore_count()) < 0)\n-\t\tgoto err;\n-\n-\t/* performance test with 1, 2 and max cores */\n \tprintf(\"start performance test for %s (without cache)\\n\",\n \t       default_pool_ops);\n-\n-\tif (do_one_mempool_test(default_pool, 1) < 0)\n+\tif (do_one_mempool_test(default_pool, cores, 0) < 0)\n \t\tgoto err;\n \n-\tif (do_one_mempool_test(default_pool, 2) < 0)\n+\tprintf(\"start performance test (with cache)\\n\");\n+\tif (do_one_mempool_test(mp_cache, cores, 0) < 0)\n \t\tgoto err;\n \n-\tif (do_one_mempool_test(default_pool, rte_lcore_count()) < 0)\n+\tprintf(\"start performance test (with user-owned cache)\\n\");\n+\tif (do_one_mempool_test(mp_nocache, cores, 1) < 0)\n \t\tgoto err;\n \n-\t/* performance test with 1, 2 and max cores */\n-\tprintf(\"start performance test (with cache)\\n\");\n+\trte_mempool_list_dump(stdout);\n \n-\tif (do_one_mempool_test(mp_cache, 1) < 0)\n-\t\tgoto err;\n+\tret = 0;\n \n-\tif (do_one_mempool_test(mp_cache, 2) < 0)\n-\t\tgoto err;\n+err:\n+\trte_mempool_free(mp_cache);\n+\trte_mempool_free(mp_nocache);\n+\trte_mempool_free(default_pool);\n+\treturn ret;\n+}\n \n-\tif (do_one_mempool_test(mp_cache, rte_lcore_count()) < 0)\n-\t\tgoto err;\n+static int\n+test_mempool_perf_1core(void)\n+{\n+\treturn do_all_mempool_perf_tests(1);\n+}\n \n-\t/* performance test with 1, 2 and max cores */\n-\tprintf(\"start performance test (with user-owned cache)\\n\");\n-\tuse_external_cache = 1;\n+static int\n+test_mempool_perf_2cores(void)\n+{\n+\tif (rte_lcore_count() < 2) {\n+\t\tprintf(\"not enough lcores\\n\");\n+\t\treturn -1;\n+\t}\n+\treturn do_all_mempool_perf_tests(2);\n+}\n \n-\tif (do_one_mempool_test(mp_nocache, 1) < 0)\n-\t\tgoto err;\n+static int\n+test_mempool_perf_allcores(void)\n+{\n+\treturn do_all_mempool_perf_tests(rte_lcore_count());\n+}\n+\n+static int\n+test_mempool_perf(void)\n+{\n+\tint ret = -1;\n \n-\tif (do_one_mempool_test(mp_nocache, 2) < 0)\n+\t/* performance test with 1, 2 and max cores */\n+\tif (do_all_mempool_perf_tests(1) < 0)\n \t\tgoto err;\n+\tif (rte_lcore_count() == 1)\n+\t\tgoto done;\n \n-\tif (do_one_mempool_test(mp_nocache, rte_lcore_count()) < 0)\n+\tif (do_all_mempool_perf_tests(2) < 0)\n \t\tgoto err;\n+\tif (rte_lcore_count() == 2)\n+\t\tgoto done;\n \n-\trte_mempool_list_dump(stdout);\n+\tif (do_all_mempool_perf_tests(rte_lcore_count()) < 0)\n+\t\tgoto err;\n \n+done:\n \tret = 0;\n \n err:\n-\trte_mempool_free(mp_cache);\n-\trte_mempool_free(mp_nocache);\n-\trte_mempool_free(default_pool);\n \treturn ret;\n }\n \n REGISTER_PERF_TEST(mempool_perf_autotest, test_mempool_perf);\n+REGISTER_PERF_TEST(mempool_perf_autotest_1core, test_mempool_perf_1core);\n+REGISTER_PERF_TEST(mempool_perf_autotest_2cores, test_mempool_perf_2cores);\n+REGISTER_PERF_TEST(mempool_perf_autotest_allcores, test_mempool_perf_allcores);\n",
    "prefixes": [
        "v7"
    ]
}