Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp31169pxb; Tue, 12 Apr 2022 15:58:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw04Q38iB2DEZvI6pv29ljohyxm2xw5WEulyYFmDtHG4NjWH+Iw1DfPJqQz694ZYcoW4B0Y X-Received: by 2002:a05:6a00:f92:b0:505:c53b:2668 with SMTP id ct18-20020a056a000f9200b00505c53b2668mr12107402pfb.64.1649804328056; Tue, 12 Apr 2022 15:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649804328; cv=none; d=google.com; s=arc-20160816; b=WGORKn3vg5LQuQus37T+CvJ/r+VkDcjtVG9Ugu2KUekT9t0pvTlDmQDWWBLvwQnjUO icgYcKeG5ZW/qABskwZ2BIlPC6mAd9bfMtB2qaacTsFXZmhi8uEc2NFROg6sf9/djMBp RWIt7CbzxdSanLAYwLByL8rMZsPjv/Hk0R2uaBI+UPmmtmFA3VNK2fJn47JrSWGFRO1g av2uJPLjSi0rY0/J0SSAVQBKCQh5YT6yw+In7+r3WcEhjM8KB4n5qxuaBTknP7jQgDYA STef4gdeJ/0uHV2ooD+JE3CaJ4++PHMHPz+0aGUiHHzf7BqCPBPpvIno6hWVJgxHh7hZ WP1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=G+0RZpqf3KzwJPURLDOzp5VeHv5/Is97npE43jIV+BQ=; b=IvSU2GaZVyVBC3bYwZBtCBb0k5tX8LSFy47pSc+CTrXh6iK6x3psixWinJ8GScDOXI mOfJKeRvrsI+wjOlK9G5FUTUPuRMGiNOVkeEy6ik61bEZlcMfD+aO7SnNKLvqYF6VEhv kuzWqvOe79ymQNQzFXY5HoLux4CPKYUECtcHi15tfD59gzr97aWRYlCJziPqVkVJsdtK DLAvBNOEsByBELqPugbe4iK0UmMxFyfZmZcYYR0nyLB8I7eNQEtP10QUfL73bRnb6ge7 +uchYNk3vnFLIre7iKHmn6OQ5EZQ7TCAZd3KFg8n81HKziyn+fb8LNulQv8bi6JdciC3 FO8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AOYCq50j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i2-20020a654d02000000b003991d7df4b8si4043775pgt.652.2022.04.12.15.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 15:58:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AOYCq50j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C8B851D97CB; Tue, 12 Apr 2022 14:40:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236050AbiDHXVB (ORCPT + 99 others); Fri, 8 Apr 2022 19:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbiDHXU7 (ORCPT ); Fri, 8 Apr 2022 19:20:59 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A044A377C0 for ; Fri, 8 Apr 2022 16:18:52 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id d40so9901132lfv.11 for ; Fri, 08 Apr 2022 16:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G+0RZpqf3KzwJPURLDOzp5VeHv5/Is97npE43jIV+BQ=; b=AOYCq50jR9qrc2EYro6XeQOFteBCb6c/hMcxBF1TZRtQb+TjlrxF/sPevQuCKcPp05 ddxaU/W2cU2INMOoSXaI0NT9nzuctbV/PvuD0jKHkqSYJs/5c2sBxed2QYr3e/qGzaqP iIpPCS3xfEKYE7pRLBQqzqOJt8HCOpRSyXBXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G+0RZpqf3KzwJPURLDOzp5VeHv5/Is97npE43jIV+BQ=; b=rtajv73t5nAI+kiKnS/8EWelliVnLDC284Tk/jE7QWYs4aH/gvD1CLLbfQsbL5Um71 pCgEclbHDFgN6bD8XsgXYW2M80NVJPgqYhOWLZk52HjtUr1OCi0BsNXvazBlEzJsDrO5 UV2HPlEqmgmABY8uApVvVn87lRP77+zRQW8d4ZwCx+kkSHHS4+Tnw2f5m6umIG3zIC3u Z4f213SenutD4Hn9l9/W0iDxa4bJ8mVqEnwYgmMuUOilauNMkjWd5p+j7AQZ0y5M3Way Zg3MjxMLoE4nGxXI252Nlgt4YgGJ3FxB9zUQ3rt/Mh4Gf9suzT7QBX5rhXn+2KEEtejf zg9g== X-Gm-Message-State: AOAM531Iy97EvegvStE9aWBWBpDpRLC495RwTa4jDejd6eUwZ2tryN8N r/wkdzhpUsFFeFtNO5+oD6aIozaX+foLM+nc X-Received: by 2002:ac2:4290:0:b0:464:f225:1a37 with SMTP id m16-20020ac24290000000b00464f2251a37mr7146946lfh.140.1649459930672; Fri, 08 Apr 2022 16:18:50 -0700 (PDT) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id c3-20020a2e9d83000000b0024b5382fef9sm220648ljj.71.2022.04.08.16.18.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Apr 2022 16:18:49 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id q14so13245264ljc.12 for ; Fri, 08 Apr 2022 16:18:48 -0700 (PDT) X-Received: by 2002:a2e:9041:0:b0:24a:ce83:dcb4 with SMTP id n1-20020a2e9041000000b0024ace83dcb4mr13349107ljg.291.1649459928561; Fri, 08 Apr 2022 16:18:48 -0700 (PDT) MIME-Version: 1.0 References: <20220407161745.7d6754b3@gandalf.local.home> <87pmlrkgi3.ffs@tglx> <20220408161025.5842a663@gandalf.local.home> In-Reply-To: <20220408161025.5842a663@gandalf.local.home> From: Linus Torvalds Date: Fri, 8 Apr 2022 13:18:27 -1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH] timers: Add del_time_free() to be called before freeing timers To: Steven Rostedt Cc: Thomas Gleixner , LKML , jstultz@google.com, Stephen Boyd , Andrew Morton , Peter Zijlstra , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Eric Dumazet , Guenter Roeck Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Fri, Apr 8, 2022 at 10:10 AM Steven Rostedt wrote: > > We have that already, it's called "del_timer_sync()". And that's not used > when it should be, and does not catch the case of the timer being rearmed. THAT'S MY POINT. It doesn't do the "no rearming". So my point is that people who actually use "del_timer_sync()" generally *want* that "no re-arming", and right now they go to extra work to do so. Because calling del_timer_sync() while the timer can get re-armed is almost always a bug _anyway_. So : - don't use the name "free" - because that's not what people always are about - aim to *replace* the current del_timer_sync() with the new functionality A new name is good. But "free" is wrong. The function doesn't free anything, and it's not necessarily even the case that all users would want to free it. I do like the "timer_shutdown()" naming that Thomas suggested. Imagine having something that just guarantees that the timer isn't running, and you have to explicitly restart it. No, del_timer_sync() doesn't do that. It only guarantees that any previously started timer has been finished. And no, currently we don't actually have a "timer_restart()". You have to re-init it completely with timer_setup(), and then do a "mod_timer()". But that's because we haven't had that "timer_shutdown()" functionality in the past. Now, most timers don't necessarily re-arm themselves at all, so those people don't care, and del_timer_sync() works for them as-is. But even if you don't have a self-rearming timer, maybe you want to make sure nobody else restarts it either. As mentioned, right now people actually do things like this manually using some flag of their own. Linus