From patchwork Tue Nov 15 13:19:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zqiang X-Patchwork-Id: 13043669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE065C433FE for ; Tue, 15 Nov 2022 13:13:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbiKONNw (ORCPT ); Tue, 15 Nov 2022 08:13:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbiKONNp (ORCPT ); Tue, 15 Nov 2022 08:13:45 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6554B1D2; Tue, 15 Nov 2022 05:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668518019; x=1700054019; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KJFXj3YWKvBgdKbZAu8eoga4jTJKbrFgb7rok5iDpxA=; b=HtIx8PUnM7oNMLWloO2Yg3latnTs7KgnJOSzZT6+9kW2Lr+Cv+7HVLrQ qJuV1ULwqyYCapdtI+LYAITqsDud4XPS83bsXWBHo2WEH4cI3KcLbKRjk et5JWV2kmKo3sgAzlPff7Gq2+xMEeHOh1VJ2Pe5ib8yHvGoeNfHydcUHk kiZy4MvnvXgjj+AvY2jU1mfBJF5Z16vyHOnm9nb9MNrHppnBu7b8dpXHR EsSHSNwuSIeixGzS6yWDDK0q2btRU/64oDZ0WDiCDFGEQybrlilQuJGOC JKzBzxbIvHdwTB4ZO99G0JD7YiV6azABaXhlEFNyydQqlrbO6aEPBz8zW Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="309875258" X-IronPort-AV: E=Sophos;i="5.96,166,1665471600"; d="scan'208";a="309875258" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2022 05:13:31 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="744586943" X-IronPort-AV: E=Sophos;i="5.96,166,1665471600"; d="scan'208";a="744586943" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.129]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2022 05:13:28 -0800 From: Zqiang 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 Message-Id: <20221115131926.3409974-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: rcu@vger.kernel.org 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 --- 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); }