From patchwork Thu Apr 6 11:59:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 96932 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp694345qgd; Thu, 6 Apr 2017 04:59:56 -0700 (PDT) X-Received: by 10.55.108.131 with SMTP id h125mr30590780qkc.199.1491479996134; Thu, 06 Apr 2017 04:59:56 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w3si1195386qtg.225.2017.04.06.04.59.55; Thu, 06 Apr 2017 04:59:56 -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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BD40664368; Thu, 6 Apr 2017 11:59:55 +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 7C65B60762; Thu, 6 Apr 2017 11:59:49 +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 4F17560A24; Thu, 6 Apr 2017 11:59:46 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0123.outbound.protection.outlook.com [104.47.2.123]) by lists.linaro.org (Postfix) with ESMTPS id 9F3FA6097D for ; Thu, 6 Apr 2017 11:59:43 +0000 (UTC) Received: from DB4PR07CA013.eurprd07.prod.outlook.com (10.242.229.23) by VI1PR0701MB1902.eurprd07.prod.outlook.com (10.167.197.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.8; Thu, 6 Apr 2017 11:59:40 +0000 Received: from VE1EUR03FT041.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::203) by DB4PR07CA013.outlook.office365.com (2a01:111:e400:9828::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.8 via Frontend Transport; Thu, 6 Apr 2017 11:59:41 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 131.228.2.241 as permitted sender) Received: from mailrelay.int.nokia.com (131.228.2.241) by VE1EUR03FT041.mail.protection.outlook.com (10.152.19.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1019.14 via Frontend Transport; Thu, 6 Apr 2017 11:59:40 +0000 Received: from fihe3nok0735.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v36Bx4NF006034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 6 Apr 2017 14:59:04 +0300 Received: from 10.144.19.15 ([10.144.104.219]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v36Bx4nL006023 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Thu, 6 Apr 2017 14:59:04 +0300 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Thu, 6 Apr 2017 14:59:03 +0300 Message-ID: <1491479944-31232-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1491479944-31232-1-git-send-email-petri.savolainen@linaro.org> References: <1491479944-31232-1-git-send-email-petri.savolainen@linaro.org> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.241; IPV:CAL; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39840400002)(39850400002)(39410400002)(39860400002)(39450400003)(39400400002)(2980300002)(199003)(189002)(9170700003)(22756006)(86362001)(110136004)(5660300001)(2351001)(5003940100001)(76176999)(50986999)(47776003)(189998001)(53936002)(38730400002)(48376002)(36756003)(6916009)(2950100002)(50226002)(305945005)(106466001)(105596002)(8676002)(77096006)(2906002)(33646002)(81166006)(8936002)(356003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB1902; H:mailrelay.int.nokia.com; FPR:; SPF:SoftFail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; VE1EUR03FT041; 1:QLOiiTU0cejGsRAZyuoFEpU+NThvi/ZR/oJ0cZs5q4/njo6BWfeTCi2MpTxggD1Nr6HEVkl4kCinll2LN5bVEIRMBdT8bpJLTqz8cBqDOEZ5A1+LPs1X0nnmYpRgiRBB3GX+1z3HSbS1A06+5LjiHzcM4dz7xzIE0EBKN2xtodxYALBQxSsev/UJkjGLlvq/64uWtWOA2ZdtwLeml2kPiDhekR8ipQC98TujGAna5c58LIqF8Y2sSN/iCKKe9nOm/xGHDXgp9Qco2NUJaFSEMMbVLdIoLq5figoMkuKY9z51/76nDYFH66DmscjapEiA6gpknkkF5y7kkQAM5MaW9gTLniBDSlce5PgNk2ulqrMCy5AxliBs0RtD5YhwtBEzm2qIZ8fV4Y3N3UTZ98tg5oP66CF9mJfrrrPiYWvBec19O0posIyM4X+wrL7YjTDtlbMG0PFNLzw9VYCzoexWfAfxzmSpaefZnzth8Eaknb6Y+VMMKP3D8eW9noCDmmVn+O57reFh5jwQlbSB2wVNdA== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 674cdcbe-f85d-4032-a97c-08d47ce467f9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081); SRVR:VI1PR0701MB1902; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1902; 3:xlq1HRKDO4Uiu7o7ynohIi/uIMTqHSxbH4RvBsrZlF+U2lQMSvxcILAaqd/jVMLy4Nysf3Xkr7CXk+jHHxV88PbKNiY3ct9rvhihL6/AvRCgKwNZptLPe0mDglHXJK/B03/pRxXlaG1M13mnaImPtVGjiIEYjRK89VxtfvzrqQ6ZStnqBggjqtggh8EcFyvxKw+M9CUfaRgMpmrS+z8kMYOvw5BA5G9WeUts1zqGEEPacG3DjLksEU4uzlDzfHeb0nOai5JBjYMd+PbyemIn+EXOUAq7234I9ORkOECCkg2fMjhls3c4oM7efGr7Tn4ok4aw0afuTwWFAChLWNHVhfrhzKaQyq+eYvcsu2olPgYS3RtSy2yhL/1MuKfVwkPm+zmp9v7f/i+a8CZPPgI/wXYgOSwcW4FJUAv3UJIJp4DZ5gbmMSiSmWCrd0NZ4+fw72kh2E9igolRpVTImUSb0g== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1902; 25:sCeAS79WgP9IJZn2eNyH+wQHG79oF+cJW2iVnQGbHAZEmlq9mG7DMJReZ5wYTUb3pUDwVfZJc3f4awdmgr2tNRS+UkzKbeiWnTkcVhTlJgsEALTH9UkpgdFKkyN1qlolBXNcHtqj643A9ffvHzt9Yq1IZaLL+a9FURkTGThI9mOjlfiTzkZw5R3HkJE01xXdXk/40DhtmXh08etOpKXNQYBwIzpCktzrWkBp1JpI/g9y5V0CC6sZ/eCoJW1y0sgmXeAU68VPjYuLJo3UvDv/clKhsGadXOAYByPPnSBvPcVJ6Qi5BkN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nvEN4mvsLP6ScHDhW2WbPZ3eMkNMwk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13013025)(13021025)(5005006)(13023025)(8121501046)(3002001)(10201501046)(93006095)(93003095)(6055026)(6041248)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123555025)(6072148); SRVR:VI1PR0701MB1902; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0701MB1902; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1902; 4:1Dfbk8/Lp16wxf9L1lAU/psa3UJxtFgzweQG49zXIxiSRiTC5bHv7iyoDF03VC5WKULYRg8hsPUl3EvWs+TMJkmPLS1aOeZPvY41PApQiVZq0A/1S5CKrJj7BPX2AjhNJsC4Mna22yFl1U6vkYlRE8HoiTTJmSOQktZ4iDfRmFuej4z6uCak8p2kauL9DRqdLwuc5sMo0QONjJXsv7XEPH2TjOSUeW2gDZICkqP8qge/HA2D0zpO9DXgHjXhI/lXVgXBrIQp5oicWSVeSLOwwGRynXIIyoyw3kIWNUUzSkPjYbVCWwfdu4wlzPyYjxo/rglbz89LuE6jvX7jjPYTeOkCsEKyeYQaQ7cAtYaDQ/E+6hX2HEYAjqzhKglqD7GDpWwgPfeivNOOZVInS2nTgvMX+jM0NlQall42IXT0BMr4d8Ve5SKFbTHAMmOgIf9m5+hfElMqr+lNvP0aUhnMCxv1/IJgASndM5KyQ7aHs0bLTkqwg4Y2qvQ7bbkT60rXFRG+hCu426rraes1Lxeqxb2gxC3HNehSTHTJ9XM3mA36YbU49NwQnmD4rusJxkExXs6Lr/ddPS4am6x+jIfMoQUkU+5n9dRdsQ6GFjDiCg94euTNfrUjfQT5D7DU0+Za0klIVJdGcE9RRewvbTl+xyNVsr+8Frgz8e/Pd5Ny5MTCmkSKTZ4qZm9JQ0EJ/b8oFW0Lc8Vhr5BPii0hD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RHD4joCeob7Mi8zy/CGG0XnG2YmkD/yvJDw9hJ5mi5NjUoEawpRSSNPjAg4blBOSzEdaxWAv85j+/g9EiYIv/M= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1902; 6:VbzFbbylH3kK/JEt6qVmuMnohcKTKpghZSvTKcpow9L5q46WB/vOy6We90Cs2MqjchVvWoqohB3vx0iXoV3tTWgmwaShVLd3IGM5HiSUhqBrWfR960EvvnXfS7/SmBOoC2MLqmZ0A+ewFcSL537v7bpkGrpSg8n8ti7jnM1NTVYjeQdS2e7iTfGPBuDgMYUP3nvEUwBFmV2kNTxLp+nNMWIbeuKxvcVND1GMKC9quYZP1zmUtg2/PCP11rFH9ne2Mi//eOiYwry67IVIdUgjaq1PHicw4aZd4VdFjq54Ik4AinMvf8xE5NZGkajGcGd3OAoXs0ZPJmf8GmpabLckG8NLnajjMdprKp+Zn7fGEHyfvsi8ps+F5UqVNu837pFw5PfDNhPlEv1AtaloI3UY1suX5RYjynUshX6/zmWHyZeXllmul3MUtVz5f703KiIg9zlf1RCRy6e2CzGUAwbhV3nzJS6MCEIo8vSah1Q5KQI=; 5:whFeoa+7nnr0Yh1X1rVT1O+AOfwJXDwAPNTw4mx3jcR7aamQn7qqQArg/fvx0VhQilw3ln4ERXzuTbma3sTeWLzG9YtSai2zoeG5bHI7cm85f28EHKGc7VLMiM2PLBf0ASysyU6POPgSJN5UBCFkfg==; 24:zPrVmcrDP0frDmNuQ9KCY+YQl18LPnuvw6gOBudpJkLY3AhbeWm/kYvvlgGHA2Lj9bB5Jt+lp6lCS6HRxr7KS2X1r4G3aktav9rKS/4XEPA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1902; 7:WRkALrDJ2wbVBVGCd7pKTH6Nyt/lSVplhfJhfadnpyVmY52NlP1IkL1vPdxE+a3Xe9/9jtZdBk43d6DIl/chFx/HItHngR7sz8UC1pc+xZEhnuhGvEARnmXhaTC/21/JUuF6s30P7Hz0ZI2uF4dd1uDddNFffZ3J0hFoJduXoznt5aBY13afsbC7723GzA4/5gQ4xjz/QUf94T82jMlDJSXwNhPpzXK7jdZKgZfLOhoOt6G8RQWmfQPoW0z5k6mHrkLABEBUiJpsYsW7lc+g98ruJ0wTFqCWy9EkR17DgJR+6DRXHHdjvwZ5MUH6tLrkM9uY/THWFwOq/3e0SgAm7w== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2017 11:59:40.3010 (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.241]; Helo=[mailrelay.int.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB1902 Subject: [lng-odp] [PATCH 2/3] linux-gen: sched: use weight table for preferences 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" A precalculated table is more flexible for tunning weights than hard coding. As future development, the table may be updated with different weights at init or run time. Signed-off-by: Petri Savolainen --- platform/linux-generic/odp_schedule.c | 51 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) -- 2.8.1 diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index cd5bf21..e7079b9 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -39,6 +39,13 @@ ODP_STATIC_ASSERT((ODP_SCHED_PRIO_NORMAL > 0) && /* Priority queues per priority */ #define QUEUES_PER_PRIO 4 +/* A thread polls a non preferred sched queue every this many polls + * of the prefer queue. */ +#define PREFER_RATIO 64 + +/* Size of poll weight table */ +#define WEIGHT_TBL_SIZE ((QUEUES_PER_PRIO - 1) * PREFER_RATIO) + /* Packet input poll cmd queues */ #define PKTIO_CMD_QUEUES 4 @@ -142,7 +149,6 @@ typedef struct { int index; int pause; uint16_t round; - uint16_t prefer_offset; uint16_t pktin_polls; uint32_t queue_index; odp_queue_t queue; @@ -157,6 +163,8 @@ typedef struct { ordered_stash_t stash[MAX_ORDERED_STASH]; } ordered; + uint8_t weight_tbl[WEIGHT_TBL_SIZE]; + } sched_local_t; /* Priority queue */ @@ -237,11 +245,29 @@ static inline void schedule_release_context(void); static void sched_local_init(void) { + int i; + uint8_t id; + uint8_t offset = 0; + memset(&sched_local, 0, sizeof(sched_local_t)); sched_local.thr = odp_thread_id(); sched_local.queue = ODP_QUEUE_INVALID; sched_local.queue_index = PRIO_QUEUE_EMPTY; + + id = sched_local.thr & (QUEUES_PER_PRIO - 1); + + for (i = 0; i < WEIGHT_TBL_SIZE; i++) { + sched_local.weight_tbl[i] = id; + + if (i % PREFER_RATIO == 0) { + offset++; + sched_local.weight_tbl[i] = (id + offset) & + (QUEUES_PER_PRIO - 1); + if (offset == QUEUES_PER_PRIO - 1) + offset = 0; + } + } } static int schedule_init_global(void) @@ -670,10 +696,10 @@ static int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[], { int prio, i; int ret; - int id; - int offset = 0; + int id, first; unsigned int max_deq = MAX_DEQ; uint32_t qi; + uint16_t round; if (sched_local.num) { ret = copy_events(out_ev, max_num); @@ -689,15 +715,15 @@ static int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[], if (odp_unlikely(sched_local.pause)) return 0; - /* Each thread prefers a priority queue. This offset avoids starvation - * of other priority queues on low thread counts. */ - if (odp_unlikely((sched_local.round & 0x3f) == 0)) { - offset = sched_local.prefer_offset; - sched_local.prefer_offset = (offset + 1) & - (QUEUES_PER_PRIO - 1); - } + /* Each thread prefers a priority queue. Poll weight table avoids + * starvation of other priority queues on low thread counts. */ + round = sched_local.round + 1; + + if (odp_unlikely(round == WEIGHT_TBL_SIZE)) + round = 0; - sched_local.round++; + sched_local.round = round; + first = sched_local.weight_tbl[round]; /* Schedule events */ for (prio = 0; prio < NUM_PRIO; prio++) { @@ -705,7 +731,8 @@ static int do_schedule(odp_queue_t *out_queue, odp_event_t out_ev[], if (sched->pri_mask[prio] == 0) continue; - id = (sched_local.thr + offset) & (QUEUES_PER_PRIO - 1); + /* Select the first ring based on weights */ + id = first; for (i = 0; i < QUEUES_PER_PRIO;) { int num;