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 D3CF770201; Sat, 6 Mar 2021 01:07:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D3CF770201 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614982029; bh=L4KCom7nuaWepG9MxTWb+ilYutZPecohg05KCTWjhQU=; 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=NTDsOxiKJOUPZMB7XMZLOXrztNV0Y2K+XOh5vAam/1FNnPAWUtpG6It5/w69WiXrr 39Y4BNfG+k2DxrikC+VTFJtPHsi9YMAiTmcSgf78DW8KAzj6cKRquUtEiXq9dVUOlT q5hFtTvikdXf/PN1PJbkKmu7kCA6n07K+jsVEQOY= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 BDE4671825 for ; Sat, 6 Mar 2021 01:06:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BDE4671825 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lIIas-0004CZ-SP; Sat, 06 Mar 2021 01:06:47 +0300 To: Oleg Babin , 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: Fri, 5 Mar 2021 23:06:45 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <755b27df-bf31-85cc-4392-69792884049e@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69B9676070C5F64E418DB309FBA590CF44700894C459B0CD1B92615E285CC8647F629A8B18DA37E12F6C0FA0DFC9439724B28006A18B89A766F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B7733D0215A2F71AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063727599E9BE65898D58638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CFC18DCDA8D016604FAA66BDC135797E57F5434A48F19F645A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7820CF4CC0E318EFB9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C33F395433950BAD63117882F4460429728AD0CFFFB425014E868A13BD56FB6657A7F4EDE966BC389F9E8FC8737B5C22495D56369A3576CBA5089D37D7C0E48F6CCF19DD082D7633A0E7DDDDC251EA7DABAAAE862A0553A39223F8577A6DFFEA7CF88153C44A01917943847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148F90DBEB212AEC08F22623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A558A9B8DC8D86F299933405BBE0862328D692A8608072B65AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3451BBE684D17D72216A9D80919D5D34265288CFBA790DC54E3B8C76947D753D0C50D07C0E0A9E2E2B1D7E09C32AA3244C753669D2136A4BDAA65AC6870519D82851E887DA02A9F7BFFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojXmjzTEesUQE7BqcNfSqtyw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822E42B235E580A9319BDDC211E584C35223841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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.