From: "Srivatsa S. Bhat (Microsoft)" <srivatsa@csail.mit.edu>
To: Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Thomas Gleixner <tglx@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Srivatsa S. Bhat" <srivatsa@csail.mit.edu>,
Prasanna Kumar T S M <ptsm@linux.microsoft.com>,
Saurabh Sengar <ssengar@linux.microsoft.com>
Subject: [PATCH 4/4] Documentation: core-api/cpuhotplug: Add naming convention for callbacks
Date: Fri, 27 Nov 2026 12:57:01 +0530 [thread overview]
Message-ID: <20261127-docs-cpuhp-v1-4-a34a2c9f66fa@csail.mit.edu> (raw)
In-Reply-To: <20261127-docs-cpuhp-v1-0-a34a2c9f66fa@csail.mit.edu>
Add a naming convention for the startup and teardown callbacks
registered for CPU hotplug states. Follow the common pattern of
subsys_cpu_mode(), where subsys is the subsystem or driver that is
registering the callback, and mode reflects the state that the
callback is associated with (ex: prepare, starting/dying,
online/offline).
Signed-off-by: Srivatsa S. Bhat (Microsoft) <srivatsa@csail.mit.edu>
---
Documentation/core-api/cpu_hotplug.rst | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst
index fe5385a8bd8e..ea00859154be 100644
--- a/Documentation/core-api/cpu_hotplug.rst
+++ b/Documentation/core-api/cpu_hotplug.rst
@@ -444,6 +444,16 @@ The @teardown argument is a function pointer to the callback which should
be invoked during a CPU offline operation. If the usage site does not
require a teardown callback, set the pointer to NULL.
+The naming convention for the @startup and @teardown callback
+functions is "subsys_cpu_mode()". For example: vmstat_cpu_online(),
+trace_rb_cpu_prepare() etc. As with the @name argument outlined above,
+other descriptive function names can also be used instead, if they
+describe the nature of the action performed by that callback better in
+the context of that subsystem (ex: free_vm_stack_cache()). However, if
+you choose to embed the mode in the function's name (i.e., prepare,
+online/offline, starting/dying etc.) as recommended, make sure that it
+aligns with the state that the callback is actually associated with.
+
The functions differ in the way how the installed callbacks are treated:
* cpuhp_setup_state_nocalls(), cpuhp_setup_state_nocalls_cpuslocked()
--
2.43.0
prev parent reply other threads:[~2026-11-27 7:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 7:26 [PATCH 0/4] cpu/hotplug: Update documentation and naming convention for hotplug callbacks Srivatsa S. Bhat (Microsoft)
2026-11-27 7:26 ` [PATCH 1/4] Documentation: core-api/cpuhotplug: Fix a few minor inconsistencies Srivatsa S. Bhat (Microsoft)
2026-11-27 7:26 ` [PATCH 2/4] cpu/hotplug: Trivial doc updates in cpuhotplug.h Srivatsa S. Bhat (Microsoft)
2026-11-27 7:27 ` [PATCH 3/4] cpu/hotplug: Demystify the terms 'BP' and 'AP' in the code Srivatsa S. Bhat (Microsoft)
2026-11-27 7:27 ` Srivatsa S. Bhat (Microsoft) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127-docs-cpuhp-v1-4-a34a2c9f66fa@csail.mit.edu \
--to=srivatsa@csail.mit.edu \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=ptsm@linux.microsoft.com \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=ssengar@linux.microsoft.com \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®