Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1387085rwb; Fri, 5 Aug 2022 00:33:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Gm4jkHkmMMl16p0MN07KZ9WSkM7GK/FHoHF7EGkInBxYNSaC+CkQe+HQydqnmHv0+zjY9 X-Received: by 2002:a63:220d:0:b0:41a:a604:8540 with SMTP id i13-20020a63220d000000b0041aa6048540mr4807327pgi.390.1659684784655; Fri, 05 Aug 2022 00:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659684784; cv=none; d=google.com; s=arc-20160816; b=PMgVp1pyizUa1kjWjeZNXg0mpnDbH4Mm3JW00QHbpBbL8sadEMFXTcRcynrQYZiMmm BlRKmmFdAsshPz+UN+udYvnMCzKSF00UYoA9CBlIktoRm3gDEB1tTe7cYORNF9l49rZj rcqEmFCuWP05Ky9JUCSuUYd0EXNr+sjSJwXwoQZMbLMMKeX42j89VWil06TKMTeTCYY9 fu5syy68lB1+S32wvjbacjftmepOhxFOaJ62KaJniey7aKf7OVsRuwxSIZJndriq5ll3 VMwVuTbG0StYLR3JSd1GVmH9dEcIT3w7YQON7ilHNq+BUA7zdHLqFNhWUPodIFZTMgW/ F6dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qGWPcFQKMIJCsAnEyc4KVEBWtMZQ/V3XWkAaB//IRfQ=; b=mw9ixbk/mBz1TGnipOjxpCABY6Lc10mqTdoAPqiUl6a9/DtSCH91+0x+e1foBtOC3u W0GBU9lJxlpgIQiInUq8DqIEdT8w6o43aA9yuxOMj0W9WT4VWfgPG1xfQwSToqaz6mIp xsw8oMpKFW/iy2ddEtEV77TSasd6FcRB4VGAhTmCCeleDvkft683q0CrLgII54e/P5Cd VuXL5VSkQ+zR2FyPcZaO6q715NUAQfa2bVvAKWnSGlvqc13y/vLnJISV88NI64xSO2Db mGnxJR0X8eW9JnDrSZZrPKMcHyKUVd0oTUQcv6wq2W6SQUtzJdtfEUCiABk+Yb610WSZ pQpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mQEFtc/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h131-20020a636c89000000b0041cd5c02963si2107000pgc.334.2022.08.05.00.32.51; Fri, 05 Aug 2022 00:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mQEFtc/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236091AbiHEHYg (ORCPT + 99 others); Fri, 5 Aug 2022 03:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231949AbiHEHYe (ORCPT ); Fri, 5 Aug 2022 03:24:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 133BB1900D for ; Fri, 5 Aug 2022 00:24:34 -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 AC546615DB for ; Fri, 5 Aug 2022 07:24:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE3F0C433D6; Fri, 5 Aug 2022 07:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659684273; bh=RMb+yWMJ1lHFHETbxbrZ62eKVFujJ06xkZ15vBzWUnE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mQEFtc/Li2O2gDEp9OJGVemiJH3nK+nLMXaLaU7X0LXyuIWupMPuLDJKMuVQkgJ3S eH0Q1N4ocIF+OMYkf105iIgEGFr6KmH+5vVEeFQXc1cUnatiwLSHBajQIFEa5tN3qg O7sMRZa9P0GmgeDSs664HNqF30jidKP5KSSysEWAPvJ1ybJ3w3tAR9x3yMbuQ1E1Ps +9e+XtH3+FlP7N5sALovH6AyIcwZLqHERWqt0jpNKcrDSFcy4Il4qbJ+I8063aN9yx b79u6JGH3zSOCQZh7O8enor0+O5MKMlpkGpigtIFT+OeqDiAtqjrCRCZd8ZS2ke+5O WvX7gXQMTvrbg== Date: Fri, 5 Aug 2022 00:24:31 -0700 From: Eric Biggers To: Siddh Raman Pant Cc: christophe.jaillet@wanadoo.fr, corbet@lwn.net, dhowells@redhat.com, edumazet@google.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, mchehab@kernel.org, rdunlap@infradead.org Subject: Re: [PATCH v2 3/3] kernel/watch_queue: Remove wqueue->defunct and use pipe for clear check Message-ID: References: <20220804144152.468916-1-code@siddh.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220804144152.468916-1-code@siddh.me> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 04, 2022 at 08:11:52PM +0530, Siddh Raman Pant wrote: > static inline bool lock_wqueue(struct watch_queue *wqueue) > { > spin_lock_bh(&wqueue->lock); > - if (unlikely(wqueue->defunct)) { > + if (unlikely(!READ_ONCE(wqueue->pipe))) { > spin_unlock_bh(&wqueue->lock); > return false; > } Why is the READ_ONCE() needed? Doesn't wqueue->lock protect wqueue->pipe? > + /* This pipe will get freed by the caller free_pipe_info(). > + * Removing this reference also prevents new notifications. > + */ This isn't the correct block comment format; it should look like: /* * This pipe will get freed by the caller free_pipe_info(). * Removing this reference also prevents new notifications. */ - Eric