public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Zhouyi Zhou <zhouzhouyi@gmail.com>, Will Deacon <will@kernel.org>,
	Marc Zyngier <maz@kernel.org>, rcu <rcu@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem
Date: Fri, 20 Jan 2023 23:25:40 +0100	[thread overview]
Message-ID: <Y8sU5ADeKpow5aUY@lothringen> (raw)
In-Reply-To: <20230119204434.4017605-1-joel@joelfernandes.org>

On Thu, Jan 19, 2023 at 08:44:35PM +0000, Joel Fernandes (Google) wrote:
> -static int tick_nohz_cpu_down(unsigned int cpu)
> +static int tick_nohz_cpu_hotplug_ret(unsigned int cpu)
>  {
>  	/*
>  	 * The tick_do_timer_cpu CPU handles housekeeping duty (unbound
> @@ -522,6 +522,16 @@ static int tick_nohz_cpu_down(unsigned int cpu)
>  	return 0;
>  }
>  
> +static int tick_nohz_cpu_down(unsigned int cpu)
> +{
> +	return tick_nohz_cpu_hotplug_ret(cpu);
> +}
> +
> +bool tick_nohz_cpu_hotpluggable(unsigned int cpu)
> +{
> +	return tick_nohz_cpu_hotplug_ret(cpu) == 0;

This is still calling the hotplug function for the CPU in order to know if the
CPU is hotpluggable...

Why not:

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index ba2ac1469d47..a46506f7ec6d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -532,7 +532,7 @@ void __init tick_nohz_full_setup(cpumask_var_t cpumask)
 	tick_nohz_full_running = true;
 }
 
-static int tick_nohz_cpu_down(unsigned int cpu)
+bool tick_nohz_cpu_hotpluggable(unsigned int cpu)
 {
 	/*
 	 * The tick_do_timer_cpu CPU handles housekeeping duty (unbound
@@ -540,8 +540,13 @@ static int tick_nohz_cpu_down(unsigned int cpu)
 	 * CPUs. It must remain online when nohz full is enabled.
 	 */
 	if (tick_nohz_full_running && tick_do_timer_cpu == cpu)
-		return -EBUSY;
-	return 0;
+		return false;
+	return true;
+}
+
+static int tick_nohz_cpu_down(unsigned int cpu)
+{
+	return tick_nohz_cpu_hotpluggable(cpu) ? 0 : -EBUSY;
 }
 
 void __init tick_nohz_init(void)




>  void __init tick_nohz_init(void)
>  {
>  	int cpu, ret;
> -- 
> 2.39.0.246.g2a6d74b583-goog
> 

  parent reply	other threads:[~2023-01-20 22:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 20:44 [PATCH] tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem Joel Fernandes (Google)
2023-01-19 23:53 ` Zhouyi Zhou
2023-01-22  1:23   ` Zhouyi Zhou
2023-01-20  7:05 ` Greg Kroah-Hartman
2023-01-20 13:32   ` Joel Fernandes
2023-01-20 13:44     ` Greg Kroah-Hartman
2023-01-20 13:47       ` Joel Fernandes
2023-01-20 22:25 ` Frederic Weisbecker [this message]
2023-01-23 15:00   ` Joel Fernandes

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=Y8sU5ADeKpow5aUY@lothringen \
    --to=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=zhouzhouyi@gmail.com \
    /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