mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zqiang <qiang1.zhang@intel.com>
To: paulmck@kernel.org, frederic@kernel.org, joel@joelfernandes.org
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] rcu: Avoid invalid wakeup for rcuc kthreads in RCU_KTHREAD_OFFCPU status
Date: Tue, 15 Nov 2022 21:19:26 +0800	[thread overview]
Message-ID: <20221115131926.3409974-1-qiang1.zhang@intel.com> (raw)

For CONFIG_PREEMPT_RT=y kernel, the "use_softirq=0" will be set, the
RCU_SOFTIRQ processing is moved to per-CPU rcuc kthreads which created
by smpboot_register_percpu_thread(). when CPU is going offline, the
corresponding rcu_data.rcu_cpu_kthread_status is set RCU_KTHREAD_OFFCPU,
and the rcuc kthreads enter TASK_PARKED state, kthreads in TASK_PARKED
state only accept kthread_unpark() to wakeup.

Therefore, This commit avoid invoke wake_up_process() to rcuc kthreads
in TASK_PARKED state.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 3ccad468887e..49dd87356851 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2375,7 +2375,8 @@ static void rcu_wake_cond(struct task_struct *t, int status)
 	 * If the thread is yielding, only wake it when this
 	 * is invoked from idle
 	 */
-	if (t && (status != RCU_KTHREAD_YIELDING || is_idle_task(current)))
+	if (t && (status != RCU_KTHREAD_YIELDING || is_idle_task(current)) &&
+				status != RCU_KTHREAD_OFFCPU)
 		wake_up_process(t);
 }
 
-- 
2.25.1


             reply	other threads:[~2022-11-15 13:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 13:19 Zqiang [this message]
2022-11-16 12:47 ` Frederic Weisbecker
2022-11-16 14:07   ` Zhang, Qiang1
2022-11-16 15:01     ` Frederic Weisbecker
2022-11-16 23:23       ` Zhang, Qiang1

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=20221115131926.3409974-1-qiang1.zhang@intel.com \
    --to=qiang1.zhang@intel.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.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®