From patchwork Thu Nov 24 14:16:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 25574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3426363wrr; Thu, 24 Nov 2022 06:22:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Ntur4EuBRViHqwAW5XdbheapIIBc1qi+jgLsiWYQuwcBzFUht6YVCCC1NgkaTT4sIrYFt X-Received: by 2002:a17:906:708d:b0:7ad:b45c:dbe7 with SMTP id b13-20020a170906708d00b007adb45cdbe7mr27415843ejk.617.1669299722827; Thu, 24 Nov 2022 06:22:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669299722; cv=none; d=google.com; s=arc-20160816; b=qqzPDK7kw2T7rSDIj7crfRdkGNy/OSmLtW1cVdytykg+3puhqzGYwCDmiuruBDkhkU +PKkACdytzeNHI5kCc2JmFa4VHWcpsFv3leID6qufIwaoYPKt6fpbOOrOjP3l30u2K3j jShKn2N6dfjwi4k0KYmG5poqFm0/+iokpDtpvVnOAwFLgEUvBXwcut4uFZiIfBB7pwVK rVHSqeoFp970qe5GJLCpuDN52QEf8A5ix+ZvLrDNlhsSpj3LhwudaRwP+nxhl34vy8DO zDVPtReA3xB0ugSGh54r9Pg+F9wpUzThGjFUkyGIi69+Lu1sg7V4EYqtDqH0TW8cwbDc cb8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=FqujO4rYZqigQGWFDiVACoUNy9ibpZJ+guS7rMcbWaQ=; b=YQu8rK8LfuHp2Mg6y1RJz6Io09tdrQhPdtiNj5/5AdQ6NqSInkohjaUgIGeQLvnG/i ITxrVPEUTbEsT88b7Oo1Yt3Ncv1u2tY72HFiK0kzGNXGUrYNui9se1bhTO9c4azUG9Tq i7FjMxjGCF46fYoUnV8tlpQc81DMPXLOgW/2z0aSEjkXWwpFpIUZwhlI4VSF2TXiR28/ yAExzMeyEBKR21ZqyaI3vuU+eBPzwRZJ1Nlk7jNvHQEaTdy1EzvyHw4t53TeGm3iCoXx wDK3Ap/+LH31A1glZp3P+XC0ljqLw/YRFZQ86Lu/zdIy2JpO2dPB7Y5ni44EVijyuAvs /xsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iashBbX7; dkim=neutral (no key) header.i=@linutronix.de header.b=2QIqB5ss; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a50c313000000b0046a711aea5csi1109511edb.147.2022.11.24.06.21.39; Thu, 24 Nov 2022 06:22:02 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=iashBbX7; dkim=neutral (no key) header.i=@linutronix.de header.b=2QIqB5ss; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230262AbiKXOQe (ORCPT + 99 others); Thu, 24 Nov 2022 09:16:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbiKXOQK (ORCPT ); Thu, 24 Nov 2022 09:16:10 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54BF1E0B62; Thu, 24 Nov 2022 06:16:09 -0800 (PST) Date: Thu, 24 Nov 2022 14:16:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669299368; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FqujO4rYZqigQGWFDiVACoUNy9ibpZJ+guS7rMcbWaQ=; b=iashBbX7527t7ilCIzhSHjavLdNeHdu/d4rCTi8tbaZHmspEK247/FIaAbMbRRFpKSyF+V 3I0E1lJGdEmpnr99Smz22jY7MNIvgSlGDLHQhCX/LIV26adTBqR+9irMDEK68Ud9dYIEYj ktrJJKmpKXC6Wmmaja/jl83PzuzFjBUdvoQBjLm10oiaviFq+ElwPukN25puCMnqDP6BQ/ zs7Oj3FFFzdEVnm+dIDChZNsbzwdMPXvLcwpcYM5vEwQH1cKciVQsjJ4NKDtOjGZLSg7FP 3heSH8B4yQ7PEAZ1gKiuYOCL+zJkaS8yJDsE88K9iUuR+lULvj8SouKJ5mu82Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669299368; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FqujO4rYZqigQGWFDiVACoUNy9ibpZJ+guS7rMcbWaQ=; b=2QIqB5ssd9mNqLQCFFBSFVD0aAYEtDMFvo9c8pF9KICu0rtLWrpET+jL+/kvVKGme0Tu6k 0i7chvXSAO+0dVAw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] Documentation: Replace del_timer/del_timer_sync() Cc: Steven Rostedt , Thomas Gleixner , Jacob Keller , "Anna-Maria Behnsen" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221123201625.075320635@linutronix.de> References: <20221123201625.075320635@linutronix.de> MIME-Version: 1.0 Message-ID: <166929936667.4906.14143095640946298807.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750319715219430566?= X-GMAIL-MSGID: =?utf-8?q?1750387626243530242?= The following commit has been merged into the timers/core branch of tip: Commit-ID: 87bdd932e85881895d4720255b40ac28749c4e32 Gitweb: https://git.kernel.org/tip/87bdd932e85881895d4720255b40ac28749c4e32 Author: Thomas Gleixner AuthorDate: Wed, 23 Nov 2022 21:18:47 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 24 Nov 2022 15:09:11 +01:00 Documentation: Replace del_timer/del_timer_sync() Adjust to the new preferred function names. Suggested-by: Steven Rostedt Signed-off-by: Thomas Gleixner Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201625.075320635@linutronix.de --- Documentation/RCU/Design/Requirements/Requirements.rst | 2 +- Documentation/core-api/local_ops.rst | 2 +- Documentation/kernel-hacking/locking.rst | 11 +++---- Documentation/timers/hrtimers.rst | 2 +- Documentation/translations/it_IT/kernel-hacking/locking.rst | 10 +++--- Documentation/translations/zh_CN/core-api/local_ops.rst | 2 +- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Documentation/RCU/Design/Requirements/Requirements.rst index a0f8164..546f23a 100644 --- a/Documentation/RCU/Design/Requirements/Requirements.rst +++ b/Documentation/RCU/Design/Requirements/Requirements.rst @@ -1858,7 +1858,7 @@ unloaded. After a given module has been unloaded, any attempt to call one of its functions results in a segmentation fault. The module-unload functions must therefore cancel any delayed calls to loadable-module functions, for example, any outstanding mod_timer() must be dealt -with via del_timer_sync() or similar. +with via timer_delete_sync() or similar. Unfortunately, there is no way to cancel an RCU callback; once you invoke call_rcu(), the callback function is eventually going to be diff --git a/Documentation/core-api/local_ops.rst b/Documentation/core-api/local_ops.rst index 2ac3f9f..a84f8b0 100644 --- a/Documentation/core-api/local_ops.rst +++ b/Documentation/core-api/local_ops.rst @@ -191,7 +191,7 @@ Here is a sample module which implements a basic per cpu counter using static void __exit test_exit(void) { - del_timer_sync(&test_timer); + timer_delete_sync(&test_timer); } module_init(test_init); diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kernel-hacking/locking.rst index b26e4a3..c5b8678 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -967,7 +967,7 @@ you might do the following:: while (list) { struct foo *next = list->next; - del_timer(&list->timer); + timer_delete(&list->timer); kfree(list); list = next; } @@ -981,7 +981,7 @@ the lock after we spin_unlock_bh(), and then try to free the element (which has already been freed!). This can be avoided by checking the result of -del_timer(): if it returns 1, the timer has been deleted. +timer_delete(): if it returns 1, the timer has been deleted. If 0, it means (in this case) that it is currently running, so we can do:: @@ -990,7 +990,7 @@ do:: while (list) { struct foo *next = list->next; - if (!del_timer(&list->timer)) { + if (!timer_delete(&list->timer)) { /* Give timer a chance to delete this */ spin_unlock_bh(&list_lock); goto retry; @@ -1005,8 +1005,7 @@ do:: Another common problem is deleting timers which restart themselves (by calling add_timer() at the end of their timer function). Because this is a fairly common case which is prone to races, you should -use del_timer_sync() (``include/linux/timer.h``) to -handle this case. +use timer_delete_sync() (``include/linux/timer.h``) to handle this case. Locking Speed ============= @@ -1334,7 +1333,7 @@ lock. - kfree() -- add_timer() and del_timer() +- add_timer() and timer_delete() Mutex API reference =================== diff --git a/Documentation/timers/hrtimers.rst b/Documentation/timers/hrtimers.rst index c1c20a6..7ac4489 100644 --- a/Documentation/timers/hrtimers.rst +++ b/Documentation/timers/hrtimers.rst @@ -118,7 +118,7 @@ existing timer wheel code, as it is mature and well suited. Sharing code was not really a win, due to the different data structures. Also, the hrtimer functions now have clearer behavior and clearer names - such as hrtimer_try_to_cancel() and hrtimer_cancel() [which are roughly -equivalent to del_timer() and del_timer_sync()] - so there's no direct +equivalent to timer_delete() and timer_delete_sync()] - so there's no direct 1:1 mapping between them on the algorithmic level, and thus no real potential for code sharing either. diff --git a/Documentation/translations/it_IT/kernel-hacking/locking.rst b/Documentation/translations/it_IT/kernel-hacking/locking.rst index eddfba8..b8ecf41 100644 --- a/Documentation/translations/it_IT/kernel-hacking/locking.rst +++ b/Documentation/translations/it_IT/kernel-hacking/locking.rst @@ -990,7 +990,7 @@ potreste fare come segue:: while (list) { struct foo *next = list->next; - del_timer(&list->timer); + timer_delete(&list->timer); kfree(list); list = next; } @@ -1003,7 +1003,7 @@ e prenderà il *lock* solo dopo spin_unlock_bh(), e cercherà di eliminare il suo oggetto (che però è già stato eliminato). Questo può essere evitato controllando il valore di ritorno di -del_timer(): se ritorna 1, il temporizzatore è stato già +timer_delete(): se ritorna 1, il temporizzatore è stato già rimosso. Se 0, significa (in questo caso) che il temporizzatore è in esecuzione, quindi possiamo fare come segue:: @@ -1012,7 +1012,7 @@ esecuzione, quindi possiamo fare come segue:: while (list) { struct foo *next = list->next; - if (!del_timer(&list->timer)) { + if (!timer_delete(&list->timer)) { /* Give timer a chance to delete this */ spin_unlock_bh(&list_lock); goto retry; @@ -1026,7 +1026,7 @@ esecuzione, quindi possiamo fare come segue:: Un altro problema è l'eliminazione dei temporizzatori che si riavviano da soli (chiamando add_timer() alla fine della loro esecuzione). Dato che questo è un problema abbastanza comune con una propensione -alle corse critiche, dovreste usare del_timer_sync() +alle corse critiche, dovreste usare timer_delete_sync() (``include/linux/timer.h``) per gestire questo caso. Velocità della sincronizzazione @@ -1372,7 +1372,7 @@ contesto, o trattenendo un qualsiasi *lock*. - kfree() -- add_timer() e del_timer() +- add_timer() e timer_delete() Riferimento per l'API dei Mutex =============================== diff --git a/Documentation/translations/zh_CN/core-api/local_ops.rst b/Documentation/translations/zh_CN/core-api/local_ops.rst index 41e4525..22493b9 100644 --- a/Documentation/translations/zh_CN/core-api/local_ops.rst +++ b/Documentation/translations/zh_CN/core-api/local_ops.rst @@ -185,7 +185,7 @@ UP之间没有不同的行为,在你的架构的 ``local.h`` 中包括 ``asm-g static void __exit test_exit(void) { - del_timer_sync(&test_timer); + timer_delete_sync(&test_timer); } module_init(test_init);