From patchwork Wed Jul 20 13:42:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 72424 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp662507qga; Wed, 20 Jul 2016 06:43:31 -0700 (PDT) X-Received: by 10.37.229.65 with SMTP id c62mr29423404ybh.96.1469022211044; Wed, 20 Jul 2016 06:43:31 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id l127si1729349qkb.107.2016.07.20.06.43.30; Wed, 20 Jul 2016 06:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 7AEB8686D6; Wed, 20 Jul 2016 13:43:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E343368437; Wed, 20 Jul 2016 13:43:20 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id DA6766825B; Wed, 20 Jul 2016 13:43:18 +0000 (UTC) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10134.outbound.protection.outlook.com [40.107.1.134]) by lists.linaro.org (Postfix) with ESMTPS id A1ECA68228 for ; Wed, 20 Jul 2016 13:43:17 +0000 (UTC) Received: from DB6PR0701CA0010.eurprd07.prod.outlook.com (10.168.7.148) by DB4PR07MB0655.eurprd07.prod.outlook.com (10.141.44.147) with Microsoft SMTP Server (TLS) id 15.1.534.14; Wed, 20 Jul 2016 13:43:14 +0000 Received: from DB3FFO11FD005.protection.gbl (2a01:111:f400:7e04::192) by DB6PR0701CA0010.outlook.office365.com (2603:10a6:4:3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10 via Frontend Transport; Wed, 20 Jul 2016 13:43:14 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.240 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.240; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.240) by DB3FFO11FD005.mail.protection.outlook.com (10.47.216.94) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Wed, 20 Jul 2016 13:43:15 +0000 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u6KDgn2o030650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 20 Jul 2016 16:42:49 +0300 Received: from 10.144.19.15 ([10.144.104.111]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u6KDgmZL030641 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 20 Jul 2016 16:42:48 +0300 X-HPESVCS-Source-Ip: 10.144.104.111 From: Matias Elo To: Date: Wed, 20 Jul 2016 16:42:48 +0300 Message-ID: <1469022168-28941-3-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469022168-28941-1-git-send-email-matias.elo@nokia.com> References: <1469022168-28941-1-git-send-email-matias.elo@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.240; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(6806005)(586003)(7846002)(19580395003)(5003940100001)(19580405001)(305945005)(8936002)(50466002)(48376002)(106466001)(450100001)(68736007)(356003)(47776003)(81156014)(50226002)(16796002)(36756003)(107886002)(110136002)(2906002)(189998001)(8676002)(33646002)(81166006)(77096005)(2950100001)(76176999)(50986999)(97736004)(87936001)(2351001)(229853001)(92566002)(11100500001)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:DB4PR07MB0655; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD005; 1:G6gs/bZlaYQGvC210rQZ3i15fNMc8BBOzmAJsRQ7cE+K4gqqbdUNNQKAqZSOFLBpF7d806ZKN77Q+bYeZOHV3r+cEBRiHEUbme1jJ/mC0lRoQfCT6En99Lp2tLrWTpd2ZQMphdoO6gTobHeo445xkFjAySlICHV0Iu1ADlMUKMXS4RFLrnTONMRO0qnhwPnKdeZpgYF9FuKXnXVDfcplSLN2R/OZpjcsJSGFdxezrkF86x8A6RQ1tV7VeA812TaoEarXJMWwp2OCQHIEaektWPcxilbuBWiB9chccd5OhhFdSyN4jae7zFCaMfPCaBO9c3AuGvw7b/JRyMpfMV8sSyo+Jj4goA5OgctTeHQ3glUFXjzumFHtEF5bsb4SNw6pQv7Cjv9/tyz7ISZDPk37yLUylUVXzVib4q5bOgw1eKaa3U3HyvzjFmtJTaBlaC948Vvpop32KCRq4sWgAfebBla7466u1SwrN78ioJZqGtK8ChcjfZCRkCDKBxltUZ/2 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 931c6f86-7c32-441d-bfac-08d3b0a3cd1e X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB0655; 2:juQhjtDuioqhPYhkkPiAvCWTmjdgLr7hnwZ+ppHY97n6ReIm6Pe7j3YusM7sYiZFbsMYWnPYhTSh5Q6rOSSKaJ3MzVghU3JEQJW6C9G9pHP5HJtXLU+LOIOE/tcjRUiNsmAa3bIGAw07qxvjgjVFTBPW0urLhTDiEZ58DKNLlq90T3c6QNZ8PqG9XczSGuOT; 3:39dO8mBCKPzJv1PIqKAZRw/T957ddS1VJ+qsAgt5IDyyEmbK+/nTpiwAWWibUmhNOtuiQGf5yLSb5SN5NsQ5op+6abgODavdxg2kt8+vdF/jpYV3S4ao7WstSpj+NfrF3a8Wx1b1M+1w71C9WClEXqQCzVsIl+FmdxnstOB6aluYGAMHoIyXpFaMlFuAaOaadKoDJ3DZRfFPzo74VMCyMIinLdtpcXgbza8mKJaSzJLIuGNpidciHJ/tE2pLV+E9YzuvV6pfEJ8d+iebZiiafA==; 25:Tea6qSlEvDhKzJMNKNfNrbJyYnb6N8qkXBLmcu3oMZHa5wQTgfH4RZjvZc2HSzNlxzOAELuve56Q9Xlz5jc40g1YWh5vgDr+IgHq3s+0L14P9lGKltXSORmLbjlR8KaSrMAeT7h4f9MAuKvj0V2/Ryw0B72qqWCbilZ8gv5jorEI971qzjCKSYgGQjcoztKA/lsSzcsvBwHDmYQv5Su3N55hxwN9MwJjx8b4l7a7PlVUaN2cFId8EwMqtfSzbADwzv5IXl2fFA6UsUz1AOx4neSfmaOTMi1LSbxir7uYFnRM8zzYGuADBBevVbIr6klP974pD0UEsl976lC0GRELlPVubb3p+uNlxPZwS3z4DCiJYz5CzIMn2TQEIKpeINqejs4wRhvOfMOZcliXABW7iuy6Ym5/zKRkgOPv34agDnU= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:DB4PR07MB0655; X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB0655; 31:5GXp5lYKZGep+Lyl4UJIiY36bD5voJZVDrTnqgrADRx6SIkXVxn14uHs5c6SE3gg3kqE3aUpcwb+rCccHxHWXSB36Q6fNYrgUXsZhKTaYhOT+ucyQEvC/gKpbJRyptN9XYifdhuSx/WVtdoQkGCbU+I7bRfIYaBl0VFtQ3Az4L9VX1OgbMxQcYdbH1ZtWNrqsH8t1miBSPsu8HeWZ0VZWg==; 20:BPNYH9VevfH5925uXiJAsEk583r1EsyhQiH6NZ74tlOMhaZseDHakXs9gKQEZnF5srU9vlH9NFI6YUU5MjaKoiOKcxgA6w9pRPgAfOc2sTafd+pwDnDy1bFan/iuCNX783Z/fKLWF7RwyKj94XU6RL6GRuLxWJkHEqKDZJ/bNjYWNZV5VfsxCepGkZYKRzMoutsJU29Zs0mgk5rZfGpP0F3c0DuiZKOczLGWD75rHAEGYrcIFeJa9VmSi/Uc4pzsrWTS1c+qPaCE5v7IDw7/C7bu4B6hMr8ihcNw9J6TCBCUUD3kS9y9/dgdTytnEOOP4vtOPhlFJ4m9b4PO0EdE6CgV1r4xpQ0IIta//9eTt4xOWZ4MKYg+p0za3hUbVjhv4P5m+94E6PuK/6f8rr6GX2bFPoAdn0QcfwWMhU8VRAftGtHb5QnNtue+uNPFbpFb8jl0Y32CqeWV+GAsipnWgt6+0CgmDEIgqVhMKCQlhbrbnGFLnxg3EA/uoCN3OgSHuvHsxBqXn5o2EKnJLoylSgyTbrUi3ZYld3ctL9dKVq5C1dQyWOAzrhqLF4t2kfnTjhiOqybXGeqCX4tb7I7A2C0xJXKa+O6xU6so2MVKYfM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(10201501046)(3002001)(6055026); SRVR:DB4PR07MB0655; BCL:0; PCL:0; RULEID:; SRVR:DB4PR07MB0655; X-Microsoft-Exchange-Diagnostics: 1; DB4PR07MB0655; 4:Q6bodas73hZNZXf66rwqIwXepfBE6+MSy/nN7X+AwkVe7WZAEUayb8jBr39J592jOmeQxxN6O9AKoIdnpluew1+rLpmgyix1OA9fJ04Y7Ro6g3JXgkLxzmgdsxmAXVGBrSF6HtNJIQ/z+k9q8CugCW4h0kRQi51Y+KGDUtscmPAFdI/jJCCwCUEr9cpsuX1wB3mxwSWqDWL3fX6Zb6wI4ns2nIe38o7sahlUoVV1ImEuhT+43JdsDVm5sorP8z1nWDoXz9CfePDP74SNoBvSIwu+2Sg86Ax6ZWoyXro2408PZURvbtg6+858srv76bvloxCcg7dKdEurajZmVWcaT42Z70Zz0Qgre3R4NVi2zl7KC2s0kRMw6+eHu0gpt3pOj6OtpMxL+pSlrFkCoVGTjLYxoWdiJCZwncMSSvHupyiFxUMqlQrGRO8MjspxYeDKfOzf6LzIrB5Xv2tnE7A/Jg== X-Forefront-PRVS: 000947967F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR07MB0655; 23:9ViZL66HVB2p/HHlXmUa512Wbx0ORCE6JIvmoAZXN?= =?us-ascii?Q?Qiu4l4aGoxK0X40m0B3Zx0/RMpQeHxwLIYQwyXb78gTPRw4Pa/xomUcAVTz6?= =?us-ascii?Q?3kY7Lu+nuKaxblOvs8AnoMPnZ1APngAtxQxZ/j4ieS9RrdRYRU/7Ys69ZoA2?= =?us-ascii?Q?GrG7J3gYHzzQr/nPpWBLpILsyimYNRxiCQ3AsQgMWMqQx44VdnE4ksj5cLZk?= =?us-ascii?Q?3dGH3YHC3odQwgwnRdNi7gjhFyOdak8MHIFSlc5APOaXNnBBmJIoIhXCHMVv?= =?us-ascii?Q?l+d9TW4pA3sDvjL1Q8cNLxzG46cm23Ts0B0C5tT19Hmho2CMbkCVVcPGbAl4?= =?us-ascii?Q?baSNcDg3zwl13UOndaFnujP2C18CsgT6Ayp2jnMRUwvpVVOBVg3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sp5nkCeFgIgLy1vCkU2RgrhWt1brP2CwtqHEXkxPG+i7vnkWxWN4k+1ICYbZb+lOJspZPomj1W3Ii1B0nf47YYMd8fo+ukm8rG71wwMRK77u6zzP6rRPPErSoZu09SXcXQwJs9jF7Qfw8J60GJ6IR8DVd+bUUsMfhu3bibhaNo70+VDKfBkH+bhYyMwD7JNsKB3w==; 5:h/9Klq+gQE0sO+6CMsMD1yM3Q162wGqLKuqeY9bi1jdHZy38u4T6Fwt3FUy6jwwgz67Lcsbqm8MFKmP9pJxk3eI6UAddmoMsikjBkE09G0+842xOyTBISNU6TS5HdtVxXieOpEMWVSYb246eVPXHXg==; 24:3Je9yTJy+SivBGuCa4aTZ9gfxj8mXs8VDMT8NVyoJERn+2vmdZKaNS7DP2Xga/aT2Y5cRj+/FNSJrmd6r+EHMw92FuJL12I307trHhRMMzI=; 7:JtV1DAlvL9gjx8yg6VMKAvYi6YjsZSX6JQ8OQKZTXfp5ij502EB8XU6vGh/+EEr636hu3IA9Za9Ta/8D36Ivnq/LJd4baUjfv0DxKSo75usHDxcs1X9/JSEiJfiJQqYc2iSxtJZkf8SFsEsNqFrJreqIzL4uLfQ1mDrsZqsmMr3DSPf7k5Jb1ddGyGnrNBxvttLBt0HhZqGXR7UaDS2/tGIOo7PgdgjpGMzoEHFtC59k+/1dULHikxjQhrI2HJZp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2016 13:43:15.5002 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240]; Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR07MB0655 X-Topics: patch Subject: [lng-odp] [PATCH v2 3/3] performance: odp_scheduling: use multi-alloc/free buffer functions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Exploit odp_buffer_alloc_multi() and odp_buffer_free_multi() functions for improved performance. Signed-off-by: Matias Elo --- test/performance/odp_scheduling.c | 51 +++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 18 deletions(-) -- 2.7.4 diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index bd37f9b..2d3da26 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -29,7 +29,7 @@ #include #define MSG_POOL_SIZE (4*1024*1024) /**< Message pool size */ -#define MAX_ALLOCS 35 /**< Alloc burst size */ +#define MAX_ALLOCS 32 /**< Alloc burst size */ #define QUEUES_PER_PRIO 64 /**< Queue per priority */ #define NUM_PRIOS 2 /**< Number of tested priorities */ #define QUEUE_ROUNDS (512*1024) /**< Queue test rounds */ @@ -131,9 +131,10 @@ static void clear_sched_queues(void) static int enqueue_events(int thr, int prio, int num_queues, int num_events, test_globals_t *globals) { - odp_buffer_t buf; + odp_buffer_t buf[num_events]; + odp_event_t ev[num_events]; odp_queue_t queue; - int i, j, k; + int i, j, k, ret; if (prio == ODP_SCHED_PRIO_HIGHEST) i = 0; @@ -144,26 +145,34 @@ static int enqueue_events(int thr, int prio, int num_queues, int num_events, for (j = 0; j < num_queues; j++) { queue = globals->queue[i][j]; + ret = odp_buffer_alloc_multi(globals->pool, buf, num_events); + if (ret != num_events) { + LOG_ERR(" [%i] buffer alloc failed\n", thr); + ret = ret < 0 ? 0 : ret; + odp_buffer_free_multi(buf, ret); + return -1; + } for (k = 0; k < num_events; k++) { - buf = odp_buffer_alloc(globals->pool); - - if (!odp_buffer_is_valid(buf)) { + if (!odp_buffer_is_valid(buf[k])) { LOG_ERR(" [%i] buffer alloc failed\n", thr); + odp_buffer_free_multi(buf, num_events); return -1; } + ev[k] = odp_buffer_to_event(buf[k]); + } - if (odp_queue_enq(queue, odp_buffer_to_event(buf))) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); - odp_buffer_free(buf); - return -1; - } + ret = odp_queue_enq_multi(queue, ev, num_events); + if (ret != num_events) { + LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ret = ret < 0 ? 0 : ret; + odp_buffer_free_multi(&buf[ret], num_events - ret); + return -1; } } return 0; } - /** * @internal Test single buffer alloc and free * @@ -211,24 +220,30 @@ static int test_alloc_single(int thr, test_globals_t *globals) */ static int test_alloc_multi(int thr, test_globals_t *globals) { - int i, j; + int i, j, ret; odp_buffer_t temp_buf[MAX_ALLOCS]; uint64_t c1, c2, cycles; c1 = odp_cpu_cycles(); for (i = 0; i < ALLOC_ROUNDS; i++) { + ret = odp_buffer_alloc_multi(globals->pool, temp_buf, + MAX_ALLOCS); + if (ret != MAX_ALLOCS) { + LOG_ERR(" [%i] buffer alloc failed\n", thr); + ret = ret < 0 ? 0 : ret; + odp_buffer_free_multi(temp_buf, ret); + return -1; + } + for (j = 0; j < MAX_ALLOCS; j++) { - temp_buf[j] = odp_buffer_alloc(globals->pool); - if (!odp_buffer_is_valid(temp_buf[j])) { LOG_ERR(" [%i] alloc_multi failed\n", thr); + odp_buffer_free_multi(temp_buf, MAX_ALLOCS); return -1; } } - - for (; j > 0; j--) - odp_buffer_free(temp_buf[j-1]); + odp_buffer_free_multi(temp_buf, MAX_ALLOCS); } c2 = odp_cpu_cycles();