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 2BD3B6EC5F; Tue, 2 Mar 2021 10:54:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2BD3B6EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614671648; bh=Yf4hZroEM02KbtOotispED5Mrv7B4JfiX71GLJ7OE10=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mgaykPksQL7gIXmz4MB2PzUAHxhXPsfM7UHUH7owkhFOITwnKLZORpG89pTO9N1/s 7WpP3zzK0zFH8X2rMfo7SIevyTvm6yFwf3jjPNMuiiCNNPvs7V7eEF1XaJpcDg8ROc st7W9/dYReF5qkRBMbjcikjr+PXHKJRMngf3cw9g= Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B2C3F6EC5F for ; Tue, 2 Mar 2021 10:54:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B2C3F6EC5F Received: by mail-lf1-f45.google.com with SMTP id v9so12047969lfa.1 for ; Mon, 01 Mar 2021 23:54:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=E9QpDs0GoaL2faQfWHBiz7mrNuxin7Tqt7+vSZl/gQA=; b=ORR+MrD8vTHJPwDn9XrG2hPCfG6HGE+uogKRZjkCnNhUX4YvW3pfPze37rZZeuj9t8 xzDvGp63sRRf+l9cVLCmN/B7wx7AVFN3h1iSJPFVzaa3V+rCW8Ss4ZBStpyzfHolQteG 1lITG3sOnMacuN9dhLzOLBvTpgZUBlzOzLVlzPeaVYevPO1bPKyZFWh8Zhv82ztEFxB9 6u/CYans+qqX7bMBO2fhOvtdxN6CdRb85l1FYIS3dxfjTgDnPoXe8rbNc0i2t1S1XyB4 iNZXwBg6YXKKhtVOO5Kd4N6Pue9ADhZr650IomvOCHw1rQBIM7uiaJ0hcV34GtOZEZq6 pqDQ== X-Gm-Message-State: AOAM530lKRfk+sSG99VGn0cia9oZ25HfFJGxVaHfEL91DdGrKYnnLEdk iqUbFShdM/w381fbwps+E36yaG7eGEo8Qg== X-Google-Smtp-Source: ABdhPJz1iT0zeaKS0FGc83QoMhn3GVb86qA5seFZIyvrwKGBULI+mVv68AtAR8mOeuUsL9Xq0jRIkg== X-Received: by 2002:a05:6512:22ce:: with SMTP id g14mr11769302lfu.101.1614671645669; Mon, 01 Mar 2021 23:54:05 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id k9sm2736175ljg.59.2021.03.01.23.54.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 23:54:04 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id DD8BA560098; Tue, 2 Mar 2021 10:54:03 +0300 (MSK) Date: Tue, 2 Mar 2021 10:54:03 +0300 To: Vladislav Shpilevoy Message-ID: References: <2ba579eef6f31d17a1670a6eaf31492366963ad9.1614637331.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) Subject: Re: [Tarantool-patches] [PATCH 1/1] fiber_cond: remove rlist_shift usages 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Tue, Mar 02, 2021 at 10:37:36AM +0300, Cyrill Gorcunov wrote: > On Mon, Mar 01, 2021 at 11:23:13PM +0100, Vladislav Shpilevoy wrote: > > @@ -94,7 +94,7 @@ fiber_cond_broadcast(struct fiber_cond *e) > > { > > while (! rlist_empty(&e->waiters)) { > > struct fiber *f; > > - f = rlist_shift_entry(&e->waiters, struct fiber, state); > > + f = rlist_first_entry(&e->waiters, struct fiber, state); > > fiber_wakeup(f); > > } > > } > > The fiber_wakeup ignores > > if (f->flags & (FIBER_IS_READY | FIBER_IS_DEAD)) > return; > > can't we hit the situation where fiber_cond_broadcast called with > dead fiber so that it won't be deleted from the list with new code? > > Actually looking into fiber_loop code I see > > static void > fiber_loop(MAYBE_UNUSED void *data) > { > ... > fiber->flags |= FIBER_IS_DEAD; > while (! rlist_empty(&fiber->wake)) { > struct fiber *f; > f = rlist_shift_entry(&fiber->wake, struct fiber, > state); > assert(f != fiber); > fiber_wakeup(f); > } > > so it should be safe with your patch, but just to make sure I didn't > miss something obvious. Still, Ack. The prev mail was just to share some thoughts.