From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id A24786EC59; Tue, 9 Mar 2021 11:04:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A24786EC59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1615277049; bh=9mLRV80rW7rNH17jMCPNmRonj3GzL+HR0z6B10TRRUE=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=y+BHRe5c85RpdhBrn6Ley9S+eYMHEHB75Eu5yv+bbhLkBaFnNaQVdBH3lQ5T9Mofp 02SyvCGCrLIlttUSPXenz09wvVTVAKCfP5tBypSUFCoAVH+J5/YIYVKMeL9VXwnPjp YX3G45VarfQAWeKmUS4KpCh1r3KKynIvlLpE/cR8= Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C328C6F3C2 for ; Tue, 9 Mar 2021 11:03:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C328C6F3C2 Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1lJXLA-0006oD-2g; Tue, 09 Mar 2021 11:03:40 +0300 To: Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org, yaroslav.dynnikov@tarantool.org References: <02df9747667f254ee5734cfafa681eead566f212.1614039039.git.v.shpilevoy@tarantool.org> <755b27df-bf31-85cc-4392-69792884049e@tarantool.org> Message-ID: Date: Tue, 9 Mar 2021 11:03:39 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69B68E0B78C18DFC811DDE0A658CF5A64D900894C459B0CD1B96D8358787E6C1F92955FA51EC4F3C2A427AC468E0AD0A919D5CCEC6C3F26A72F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F2919D563845004AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063745D431239A8C7DA08638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C1F4A82545730C761BD0B45E6F210643BC1147BDBAFAC17B5A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE764603B5C71CE8B8F9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3FCE5E68AF59B345D117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF8A2765277F08B644BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6B880EA3D0D04DCFA76E601842F6C81A1F004C90652538430CDED94BCBF13EF3B93EC92FD9297F6718AA50765F7900637F42730888E86278DA7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89FBFBFE0634520CEB9A91E23F1B6B78B78B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DB48C21F01D89DB561574AF45C6390F7469DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46D9F59D329185D70BB355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A519C69817F4A8D54F14CBA04E379A720262BB0D91F3505702D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C786159FDC4342B0214577E39A49A52F79D667FC342739F8FB440C16218AD27896FFB0B5E105BEE01D7E09C32AA3244C330D3AAC90C9E5660440B487FC1EBE747C0C08F7987826B9FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojUqxEkzHTt/iu5YiVx0/j6Q== X-Mailru-Sender: 583F1D7ACE8F49BD3369739A12991F4DA829AB3FFAEFBD35D4FE7FB1A5208AA83A7A9A8B07ACFACA23E75C7104EB1B885DEE61814008E47C7013064206BFB89F93956FB04BA385BE9437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH vshard 10/11] sched: introduce vshard.storage.sched module X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Oleg Babin via Tarantool-patches Reply-To: Oleg Babin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for explanation. LGTM. On 06.03.2021 01:06, Vladislav Shpilevoy wrote: > Thanks for the review! > > On 04.03.2021 22:02, Oleg Babin wrote: >> Hi! I've looked your patch again. See one comment below. >> >> On 23.02.2021 03:15, Vladislav Shpilevoy wrote: >>> +-- >>> +-- Return the remaining timeout in case there was a yield. This helps to save >>> +-- current clock get in the caller code if there were no yields. >>> +-- >>> +local function sched_ref_start(timeout) >>> +    local deadline = fiber_clock() + timeout >>> +    local ok, err >>> +    -- Fast-path. Moves are extremely rare. No need to inc-dec the ref queue >>> +    -- then nor try to start some loops. >>> +    if M.move_count == 0 and M.move_queue == 0 then >>> +        goto success >>> +    end >>> + >>> +    M.ref_queue = M.ref_queue + 1 >>> + >>> +::retry:: >>> +    if M.move_count > 0 then >>> +        goto wait_and_retry >>> +    end >>> +    -- Even if move count is zero, must ensure the time usage is fair. Does not >>> +    -- matter in case the moves have no quota at all. That allows to ignore them >>> +    -- infinitely until all refs end voluntarily. >>> +    if M.move_queue > 0 and M.ref_strike >= M.ref_quota and >>> +       M.move_quota > 0 then >> Is it reasonable to check `move_quota > 0`. According tests it always should be positive. >> >> I see similar check for `ref_quota` as well. > These are special cases covered with tests in unit-tap/scheduler.test.lua > in test_move_zero_quota() and test_ref_zero_quota(). > > Zero quota means the operation can be suppressed by the other operation > infinitely long.