Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2667838pxm; Mon, 28 Feb 2022 03:58:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8I/KHk4FlUg89xmL0QoGEXIxa8ejTWkpzdCtnD9hFpdtL48MO3HYQFkxMVYH7qeXroGVb X-Received: by 2002:a17:902:c94b:b0:151:42b0:f79d with SMTP id i11-20020a170902c94b00b0015142b0f79dmr12480681pla.142.1646049515236; Mon, 28 Feb 2022 03:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646049515; cv=none; d=google.com; s=arc-20160816; b=Ns4u3Q/hMO6rxfpLoc4d/iZHsyey3Fj6ZOBvZq9DjhzdZ6MO9XMqusdeCfYiIrnOBQ tZ56vVE7v4pVOAU/VewvYq2sEnNTYHQhTKuhYUtG47+WPVOMQlNTdEAc2h4lUr92NpNQ dXMJJPHENEM+kXVr6qLoBQmWUtNRCstEH2d0bKkFF585j0eyZltrvsjuIhdMhp0D+/Lt zfeA3xOOgSUJQvbdY+I2795XcKKoitev10Xt6NBarAWRIkSZgw0eUTJMJQcqCXJFOjPE VZDBbDHlE3QUfwsEQrRxR5J67ga2iSIe4lc9VPRBGGN4vczm5R03iBfzpIVvX4qsJU7w jSLQ== 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=Rp78EnhJMDSdIbSXkUWIHB8hMPjViOi6I3m/S1zEYGo=; b=YikGNyecYXYU4HXZen+XW9s+6zz+4hMm+R8nEYTN6PRpeBDuEjR0xBlGWItNzLbuVF BLF3cmYqXzhfgPswiWrTLrf7smYbvr5tEMoAykeby3rdV/pve/wPpGwk4sX207A3F4FU Y/YnTskNGUUfeQsZxUUdicYL1VLjHME/4kAxu48A++H+QTXHtMCAUUL0h5MndF081k1h iJtt7fO1owAIXzDmb6CKv4guIArO5lMbuYexZxsIjeKhKJi3sRRKmww/j1Juc8BcgOBd wl2f8YuWFg754+3LEZycEqxPONU0pPU0n9wspQsnIqL3qFVNMmpDChYc7ThUMxkNd6cB pvsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=oB7lmLwF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a1709026b0400b001500bd22328si8570362plk.34.2022.02.28.03.58.20; Mon, 28 Feb 2022 03:58:35 -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=oB7lmLwF; 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 S234340AbiB1Jg3 (ORCPT + 99 others); Mon, 28 Feb 2022 04:36:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiB1Jg2 (ORCPT ); Mon, 28 Feb 2022 04:36:28 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 316C85BD31 for ; Mon, 28 Feb 2022 01:35:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646040949; x=1677576949; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NweViYYo1lLcSvZJPVLclYJYDxYs37WMqWxfMCuRKMw=; b=oB7lmLwFsuBwpNyG0sLn/dZdfVoROTDSedeAW+QSXDV0cExWbZogwnEP ikbwnD4TlzEd1j/bqvxr5Jq+UiHutlJGyWd7/cbQxJ6EBWp87Pt2LC/fd n5IAkYHheN7jzlPKoPhTyWAIWBF/hG/5n2Gs8LF6RtrYZarJvS82LlU9c lSqIYJlLFwQ+yCgn1xzWz4n7n0WXJmaJcovMdPiDInaB+naY+1bDxY+2u g+Zr+XivmdeuUqbphNdvwCgBbxomJgVw8Kk8bYr2OpqL1wPGx5+68Cfpq M6lcV3yxpDE+YVowNbF/BbPW1XjKWFDj5U30riSNR3xo2Hty+Ehn9xJ3+ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="252573377" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="252573377" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 01:35:40 -0800 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="550167403" Received: from zq-optiplex-7090.bj.intel.com ([10.238.156.125]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2022 01:35:39 -0800 From: Zqiang To: paulmck@kernel.org, frederic@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] rcu/nocb: Clear rdp offloaded flags when rcuop/rcuog kthreads spawn failed Date: Mon, 28 Feb 2022 17:36:29 +0800 Message-Id: <20220228093629.3746473-1-qiang1.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 When CONFIG_RCU_NOCB_CPU is enabled and 'rcu_nocbs' is set, the rcuop and rcuog kthreads is created. however the rcuop or rcuog kthreads creation may fail, if failed, clear rdp offloaded flags. Signed-off-by: Zqiang --- kernel/rcu/tree_nocb.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h index 46694e13398a..94b279147954 100644 --- a/kernel/rcu/tree_nocb.h +++ b/kernel/rcu/tree_nocb.h @@ -1246,7 +1246,7 @@ static void rcu_spawn_cpu_nocb_kthread(int cpu) "rcuog/%d", rdp_gp->cpu); if (WARN_ONCE(IS_ERR(t), "%s: Could not start rcuo GP kthread, OOM is now expected behavior\n", __func__)) { mutex_unlock(&rdp_gp->nocb_gp_kthread_mutex); - return; + goto end; } WRITE_ONCE(rdp_gp->nocb_gp_kthread, t); if (kthread_prio) @@ -1258,12 +1258,22 @@ static void rcu_spawn_cpu_nocb_kthread(int cpu) t = kthread_run(rcu_nocb_cb_kthread, rdp, "rcuo%c/%d", rcu_state.abbr, cpu); if (WARN_ONCE(IS_ERR(t), "%s: Could not start rcuo CB kthread, OOM is now expected behavior\n", __func__)) - return; + goto end; if (kthread_prio) sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); WRITE_ONCE(rdp->nocb_cb_kthread, t); WRITE_ONCE(rdp->nocb_gp_kthread, rdp_gp->nocb_gp_kthread); + return; +end: + if (cpumask_test_cpu(cpu, rcu_nocb_mask)) { + rcu_segcblist_offload(&rdp->cblist, false); + rcu_segcblist_clear_flags(&rdp->cblist, + SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP); + rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_LOCKING); + rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_RCU_CORE); + } + return; } /* How many CB CPU IDs per GP kthread? Default of -1 for sqrt(nr_cpu_ids). */ -- 2.25.1