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 954B86EC5F; Tue, 2 Mar 2021 10:37:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 954B86EC5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614670659; bh=nU/z+dND29j+Q1udt+Ag+vLsgUF84dTEwdS9g8x7Xhc=; 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=BUI23lUkRezbbzWRfNcaCKp5I/pGOvyULYlbnATIJmI9cTK1UPDsb164blsD5g5Kc iLPtO6fddKNGbHF0xcWyf9BzbTKeCCOYeF1BuO0cx5XJUAA2kKd5u+cT9ZaDgJsNkc zQQX632G8Y530JeAaWSIPqD44tXGUGVGmnHVckSM= Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 4D4746EC5F for ; Tue, 2 Mar 2021 10:37:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4D4746EC5F Received: by mail-lf1-f53.google.com with SMTP id 18so21203146lff.6 for ; Mon, 01 Mar 2021 23:37:39 -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=EC36WeeaG0TbLxQS4gbRW0QKlQ4vqUsDw70xzbe4WrU=; b=RSMaVyuFIbASC1FqtHkcT1kwg0+UGYL0ZiGJ7VM+00Ku1iKVPJe2V1ZTIXudR7+No7 5kf+vAFSG6jPm7whNvCvagYV3XjEKRqh1oSt8i86bK1HzBubjYK23OZRKKYdJEgbxr/w aw/jxGM+cXOINIZyN7jeqHeczW8HF/+Qy5wI849S5pWOBj28I1xTBBrJ7aNJtN4Y/Tvg dgn9KtptoDYZb8w9M/tlYRNpXBB2YvbTbZBOzNxh8kjAbHjR4o0zOt+TN6+GmLKpdFO7 7Oy5zLmYSQb4zyzJ1DPU7hw7tSmis0MSwfvtJg0zMT+7e9XrvlRGoqIJrWztoGp84Q1O mLPg== X-Gm-Message-State: AOAM531o2umqM1UNSnXfE9wW1y5Qiox+ONc4etHFxJbCG79i4Igdk7+4 hpRTk5Ip62Nvh0LTJRXw6aAbTW2pVK0Xnw== X-Google-Smtp-Source: ABdhPJwdPQ45L1Xo8XzOTPazRzter0qrwm+yH598078CreADnNK0oLWLO+tdC1t6YiawAjujC8YnHQ== X-Received: by 2002:a19:4953:: with SMTP id l19mr11078794lfj.519.1614670658191; Mon, 01 Mar 2021 23:37:38 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id l29sm2249576lfp.63.2021.03.01.23.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 23:37:37 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id AD9BE560098; Tue, 2 Mar 2021 10:37:36 +0300 (MSK) Date: Tue, 2 Mar 2021 10:37:36 +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: <2ba579eef6f31d17a1670a6eaf31492366963ad9.1614637331.git.v.shpilevoy@tarantool.org> 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 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.