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: 20368 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2719257wru; Tue, 15 Nov 2022 05:16:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf6qBADxIlbNdVtSKYVPhpT99jC6Hh0I751GHykklim5+NqMuid929t5nxZF+4yZ2WZfkTzv X-Received: by 2002:a17:90b:2406:b0:211:906a:f8ef with SMTP id nr6-20020a17090b240600b00211906af8efmr2246448pjb.71.1668518210012; Tue, 15 Nov 2022 05:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668518210; cv=none; d=google.com; s=arc-20160816; b=URlVtMDp/fmi8mOjBWg00wRENg8q+z6RJtrRqQ2pVzNYtUxFVKj3HYdtrKis1RBF2f Glh+T2RMV46ucrzU7fcQUdm4RIBy83NRwlgwnyMnyJRf71my3qLc7VI5T6XrhX2x4mLF Z5GA7cQ1xbgmkVg8eoClhz597SytQQOJg4LB3g6FlH7YIkrUAL+daMAvYtFFLREK6vb+ mcEcnwaLmfdRjf94RCP7SGkaVQ90akWev/V+OLb9nX4e/dOMzj3u8nh3Gwvc2ONb+beD rUJFIMmk1JGPtO6n8cBcPDE2rXkrTNqfFiT0bfnMklufGUA+Co3ZFj2xYb1Y2jlswNCi sn5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6Min09Rk12NgZBMgljA0Dt7ol1SuIA2cq3o6DzrFJAU=; b=tOwqE/ZtSLs6M44LPiyzbEY5FOlbd5G/kHyXNzR9voAhymAk1zqBEZCkdTFEzJ9ZIf /EgFQCN96FYXor11hRKdoNwjVe2XTNHPKPnlV0FB63cr81iQ3MhXwPwqEUMoEVY0+VPd 3j+hMGOegMjAmVL5J+LxLpYmk0gCN3bZrMeMDYE0Zr7bKQkCu5pJ6an5CaSe+WFSns0N ho3W923Wjy39hJWHZXHbiSNPBqQAyBF8AVcpL1HuJYyecJyY3IRgXQrA23Ky1v2W5dHP x3OGm0gD4HdZdELIv9N1lUKFhRRRrKRSH+G/I+Lkqk0t0hfWsEnQQ6+mEY4ekqJliiKy H9jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HtIx8PUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020a056a001d0b00b0056e8a852e3esi11538822pfx.219.2022.11.15.05.16.34; Tue, 15 Nov 2022 05:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HtIx8PUn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230192AbiKONNz (ORCPT + 99 others); Tue, 15 Nov 2022 08:13:55 -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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749568150323509264?= X-GMAIL-MSGID: =?utf-8?q?1749568150323509264?= 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); }