Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3082226rwi; Fri, 28 Oct 2022 15:43:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jbr+R9j24GhTLheM1zacpeFxI79kVCYogO8MQ2m8W7y6b5tnPeWFD4qOw+gr2NX6x+gnx X-Received: by 2002:a17:907:8688:b0:791:91a0:fdb3 with SMTP id qa8-20020a170907868800b0079191a0fdb3mr1340002ejc.499.1666997021468; Fri, 28 Oct 2022 15:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666997021; cv=none; d=google.com; s=arc-20160816; b=AaNVeLqy9U6vrWt77vWUQkU3t0mBtu6DZ4pM0npTLY6NofKRMYXSPy0pZwSdD5Mih3 PmS2dY5uVY1AkkOrxwautzSMFGEmH17aIUqvtnH4gjj99zbZ3scEY4A0ViYpFj5kuS2O 8lGC5nY8dCzK4ygfJ3rbz9zDj1G8aO1xzD4Ea70Um3rQ/d8cKQc1NBa1abllDE9McoZ0 hR8li9kUDOIg0gbec1CcDiUlfqWIqWQ1uUdRrsyqv+wRvgL+VeFH1sW38s6lEROx0mvT Y14kyIE9WswHAi3aAOkAXbk2B+L+NDVmlYmoL6Qh5bFvJEe9R3bBgdmFaUrzRfc+neS1 qW5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=jIlEHaDFx+S2glECntYrxXwaN8LuVz2LloDel6PVXso=; b=qrjpwSO4PnuAPJaWojB3XmIpnM9W3GbIe5DYDmf7Sfi9ZpPHv1MSAffiZHY9e11YnU e1hZkRajJeTPrIspzWeTMRrTcqQAULLB8PBf5z8vJP8ZrbWQ6PEMBzmDCpv+le6IDvHT oE3rKRuJovpDuDTTTP90B9JU9skj07vQslDVhsFJvRh97wLuqh0ACXZvA4XCVjDxLAB/ zG22RuHVlSbLUc/ci8hk6WFdELQnX2qIHUV8r1WLN5Lw7kX8gqjuhTP7Xt3G72q2ybYs gLVNnpNnM9aAZ5uRinEubuWSalScUIgZ0fRmp7pa2uZlkuQVbqE4WJRlvbehtxgVQ/w+ tN0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd42-20020a17090796aa00b007ab1b8b71a2si6811808ejc.821.2022.10.28.15.43.07; Fri, 28 Oct 2022 15:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbiJ1Wbi (ORCPT + 99 others); Fri, 28 Oct 2022 18:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiJ1Wbi (ORCPT ); Fri, 28 Oct 2022 18:31:38 -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 1269BDFB78; Fri, 28 Oct 2022 15:31: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 5D94D62AC3; Fri, 28 Oct 2022 22:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A8BFC433D6; Fri, 28 Oct 2022 22:31:33 +0000 (UTC) Date: Fri, 28 Oct 2022 18:31:49 -0400 From: Steven Rostedt To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Stephen Boyd , Guenter Roeck , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Mirko Lindner , Stephen Hemminger , Martin KaFai Lau , Alexei Starovoitov , Kuniyuki Iwashima , Pavel Begunkov , Menglong Dong , linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, bridge@lists.linux-foundation.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, lvs-devel@vger.kernel.org, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net Subject: Re: [RFC][PATCH v2 19/31] timers: net: Use del_timer_shutdown() before freeing timer Message-ID: <20221028183149.2882a29b@gandalf.local.home> In-Reply-To: <20221027183511.66b058c4@gandalf.local.home> References: <20221027150525.753064657@goodmis.org> <20221027150928.780676863@goodmis.org> <20221027155513.60b211e2@gandalf.local.home> <20221027163453.383bbf8e@gandalf.local.home> <20221027170720.31497319@gandalf.local.home> <20221027183511.66b058c4@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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-nfs@vger.kernel.org Could someone from networking confirm (or deny) that the timer being removed in sk_stop_timer() will no longer be used even if del_timer() returns false? net/core/sock.c: void sk_stop_timer(struct sock *sk, struct timer_list* timer) { if (del_timer(timer)) __sock_put(sk); } If this is the case, then I'll add the following interface: del_timer_sync_shutdown() // the common case which syncs del_timer_shutdown() // the uncommon case, that returns immediately // used for those cases that add extra code to // handle it, like sk_stop_timer() Which has the same semantics as del_timer_sync() and del_timer() respectively, but will prevent the timer from being rearmed again. This way we can convert the sk_stop_timer() to: void sk_stop_timer(struct sock *sk, struct timer_list* timer) { if (del_timer_shutdown(timer)) __sock_put(sk); } We can also add the del_timer_shutdown() to other locations that need to put a timer into a shutdown state before freeing, and where it's in a context that can not call del_timer_sync_shutdown(). -- Steve