From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75E7DC77B73 for ; Wed, 31 May 2023 22:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231221AbjEaW0k (ORCPT ); Wed, 31 May 2023 18:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbjEaW0j (ORCPT ); Wed, 31 May 2023 18:26:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1B1E121; Wed, 31 May 2023 15:26:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89027638CF; Wed, 31 May 2023 22:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7C3FC433EF; Wed, 31 May 2023 22:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1685571996; bh=GLdTZT4HM6RZRsPHV8a0vMFjHc8lEpx8uCyJo3MeHgU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TZMfM5rswADqWCsRolufOd8giHly7EDvFZjm1j2z6+ao1px7qYu7rmis+fh7q7wGx rgHvIqscK/GbFqLhz4wF4JJ7Ti8LQijh8/3GQ27JAo6Vg53xEFp4FaPH6GtmKGcBb1 PP3FRUr1LW7tUfBJ7nySU1daueFlDWgKO3TZH7MY= Date: Wed, 31 May 2023 15:26:35 -0700 From: Andrew Morton To: Benjamin Segall Cc: Christian Brauner , Eric Biggers , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH RESEND] epoll: ep_autoremove_wake_function should use list_del_init_careful Message-Id: <20230531152635.e8bb796bee235977c141138c@linux-foundation.org> In-Reply-To: References: <20230531015748.GB1648@quark.localdomain> <20230531-zupacken-laute-22564cd952f7@brauner> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, 31 May 2023 15:15:41 -0700 Benjamin Segall wrote: > >> Can you please provide a more detailed explanation about why > >> list_del_init_careful() is needed here? > > > > Yeah, this needs more explanation... Next time someone looks at this > > code and there's a *_careful() added they'll want to know why. > > So the general reason is the same as with autoremove_wake_function, it > pairs with the list_entry_careful in ep_poll (which is epoll's modified > copy of finish_wait). > > I think the original actual _problem_ was a -stable issue that was fixed > instead by doing additional backports, so this may just avoid potential > extra loops and avoid potential compiler shenanigans from the data race. The point is that the foo_careful() callsites should be commented, please.