All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com
Cc: linux-kernel@vger.kernel.org, Yafang Shao <laoar.shao@gmail.com>,
	Valentin Schneider <valentin.schneider@arm.com>
Subject: [RFC PATCH 1/4] stop_machine: Move cpu_stop_done into stop_machine.h
Date: Thu,  4 Nov 2021 14:57:10 +0000	[thread overview]
Message-ID: <20211104145713.4419-2-laoar.shao@gmail.com> (raw)
In-Reply-To: <20211104145713.4419-1-laoar.shao@gmail.com>

Move struct cpu_stop_done into the stop_machine.h, then it can be resued
by the functions outside of stop_maichine.c.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
---
 include/linux/stop_machine.h | 12 ++++++++++++
 kernel/stop_machine.c        | 14 ++------------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 46fb3ebdd16e..b1234cb6ab70 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -20,6 +20,15 @@
 typedef int (*cpu_stop_fn_t)(void *arg);
 
 #ifdef CONFIG_SMP
+/*
+ * Structure to determine completion condition and record errors.  May
+ * be shared by works on different cpus.
+ */
+struct cpu_stop_done {
+	atomic_t		nr_todo;	/* nr left to execute */
+	int			ret;		/* collected return value */
+	struct completion	completion;	/* fired if nr_todo reaches 0 */
+};
 
 struct cpu_stop_work {
 	struct list_head	list;		/* cpu_stopper->works */
@@ -29,6 +38,9 @@ struct cpu_stop_work {
 	struct cpu_stop_done	*done;
 };
 
+void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo);
+void cpu_stop_signal_done(struct cpu_stop_done *done);
+
 int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
 int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *arg);
 bool stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index cbc30271ea4d..cc94eb7d2c5c 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -23,16 +23,6 @@
 #include <linux/nmi.h>
 #include <linux/sched/wake_q.h>
 
-/*
- * Structure to determine completion condition and record errors.  May
- * be shared by works on different cpus.
- */
-struct cpu_stop_done {
-	atomic_t		nr_todo;	/* nr left to execute */
-	int			ret;		/* collected return value */
-	struct completion	completion;	/* fired if nr_todo reaches 0 */
-};
-
 /* the actual stopper, one per every possible cpu, enabled on online cpus */
 struct cpu_stopper {
 	struct task_struct	*thread;
@@ -67,7 +57,7 @@ void print_stop_info(const char *log_lvl, struct task_struct *task)
 static DEFINE_MUTEX(stop_cpus_mutex);
 static bool stop_cpus_in_progress;
 
-static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
+void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
 {
 	memset(done, 0, sizeof(*done));
 	atomic_set(&done->nr_todo, nr_todo);
@@ -75,7 +65,7 @@ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
 }
 
 /* signal completion unless @done is NULL */
-static void cpu_stop_signal_done(struct cpu_stop_done *done)
+void cpu_stop_signal_done(struct cpu_stop_done *done)
 {
 	if (atomic_dec_and_test(&done->nr_todo))
 		complete(&done->completion);
-- 
2.17.1


  reply	other threads:[~2021-11-04 14:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 14:57 [RFC PATCH 0/4] sched: Introduce cfs_migration Yafang Shao
2021-11-04 14:57 ` Yafang Shao [this message]
2021-11-05 17:00   ` [RFC PATCH 1/4] stop_machine: Move cpu_stop_done into stop_machine.h Valentin Schneider
2021-11-06  7:30     ` Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 2/4] sched/fair: Introduce cfs_migration Yafang Shao
2021-11-04 22:22   ` kernel test robot
2021-11-05  6:48     ` Yafang Shao
2021-11-04 22:22   ` [RFC PATCH] sched/fair: __pcpu_scope_cfs_migrater can be static kernel test robot
2021-11-05  6:45     ` Yafang Shao
2021-11-05 17:01   ` [RFC PATCH 2/4] sched/fair: Introduce cfs_migration Valentin Schneider
2021-11-06  7:40     ` Yafang Shao
2021-11-09 10:47       ` Valentin Schneider
2021-11-10 14:17         ` Yafang Shao
2021-11-07  9:38   ` [sched/fair] 64228563c2: WARNING:at_kernel/kthread.c:#__kthread_bind_mask kernel test robot
2021-11-07  9:38     ` kernel test robot
2021-11-08  3:53     ` Yafang Shao
2021-11-08  3:53       ` Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 3/4] sched/fair: Do active load balance in cfs_migration Yafang Shao
2021-11-04 14:57 ` [RFC PATCH 4/4] sched/core: Do numa " Yafang Shao
2021-11-05 17:02   ` Valentin Schneider
2021-11-06  7:40     ` Yafang Shao
2021-11-05 17:00 ` [RFC PATCH 0/4] sched: Introduce cfs_migration Valentin Schneider

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=20211104145713.4419-2-laoar.shao@gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.