Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11166741ybi; Thu, 25 Jul 2019 11:08:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrn9Mf7wCoNXCXIWGU36/iAlbilOUlxShNC8iwEJ6ABhTJXigPngZf1oDx/WSJJ2LG3dKh X-Received: by 2002:a17:902:8649:: with SMTP id y9mr90511651plt.289.1564078100271; Thu, 25 Jul 2019 11:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564078100; cv=none; d=google.com; s=arc-20160816; b=uwO6aaAQbRxr47Yu1Uog0LGCsHp8+hJYc7J8DiEO9CXk6Aqf+AyGqaW0uDUzc+oyRV oTivEnW6JBHr+13rhPmBAqVnjUt6N0q4FzW/HaUBI1ayyxFEyV94o5yHZRiGvRleG2DW s6BqmbdMbYyJmUOEWiPfZDT6lAYxnyvlv2K4/wvc6eo0DbbIg9nWLRUdNShAeUhoKkjW cVIbRT4b8FKMYbtoYlXPsSl+NFZBaE1P1qeNFQHajmr4HKOwy4XXRLSGlD191UZlJ6OF PcMaZEbN+tCq6A/HgMw4YnlxjKDeuaH0QApZ4LlYIDoGt/THV9iYFSXn/On8rCihpD0W 5QxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=nxA6pw+0kkdmyEyEUASWzYnVUed0fSQ6Ni6z51k5ChY=; b=stfTKn4APZ/a12/TWjzsahDUdPJhkssSmQcmjw7gHu3GDhUlPOvLGTCrsD7OYezc/Q wPe+uMY3cxSnRWW0hctEHWDdJD/rFT4dpCn59/d0Ri7btUI1l2YJE5lHUTY9pHfZpRYu ZpPpzZ7vKpk5sOsvBivg4tMb+pLcAxyYbpunPhkiAgcKUffjxGfn4Dm8l9hUnlvPbDJ+ SgyM/phX650Vs+KMF3YhD9pl0g3BwpGM5Qst44s4FmtomIeWxffCTJTb5jszUaBLapq8 HI/qJBv5K20YiJx5edUjHTohz7azQzN35Gi8MC0b87TaQABJQEKoQFrh3GKODHj54V9f k1/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019071901 header.b="2oeaKC/e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si17816687pgh.410.2019.07.25.11.08.04; Thu, 25 Jul 2019 11:08:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2019071901 header.b="2oeaKC/e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390487AbfGYQYh (ORCPT + 99 others); Thu, 25 Jul 2019 12:24:37 -0400 Received: from terminus.zytor.com ([198.137.202.136]:37931 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387722AbfGYQYh (ORCPT ); Thu, 25 Jul 2019 12:24:37 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x6PGOA9j1078434 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 25 Jul 2019 09:24:10 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x6PGOA9j1078434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019071901; t=1564071851; bh=nxA6pw+0kkdmyEyEUASWzYnVUed0fSQ6Ni6z51k5ChY=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=2oeaKC/e1Rq8qagAfOV2af1thXoIw13DZdHHV+5Gf7GWtk1dUc0tnCNyQQHGNoL6F rqvWNmpx4R2eSWC4lhDrd2hR3CDtO6PkFS+6tPNgeloOChtLwnrVoR2GYYiKSef5di a7GFkKvFmtnNZ95dPXbv1yduaRHej4vjDsp1oRPpUt+HmZzgWIoBi+2lGZuHVCusyV E9L9CWgqC04bzmCkV49UECAMCDhp2lERFLhhjMGNw1Q80K3Z3pGy0HepLkGW4db3l2 tmVsLoXQIyLprbiQc+GZVJEH96xfVytMEJPFasGRfI10LL5H52jGr++pIg/k+iIBKf B8DXSW10khYCQ== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x6PGOAbl1078430; Thu, 25 Jul 2019 09:24:10 -0700 Date: Thu, 25 Jul 2019 09:24:10 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Juri Lelli Message-ID: Cc: juri.lelli@redhat.com, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, dietmar.eggemann@arm.com Reply-To: hpa@zytor.com, juri.lelli@redhat.com, torvalds@linux-foundation.org, dietmar.eggemann@arm.com, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20190719140000.31694-8-juri.lelli@redhat.com> References: <20190719140000.31694-8-juri.lelli@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] rcu/tree: Call setschedule() gp ktread to SCHED_FIFO outside of atomic region Git-Commit-ID: 1a763fd7c6335e3122c1cc09576ef6c99ada4267 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1a763fd7c6335e3122c1cc09576ef6c99ada4267 Gitweb: https://git.kernel.org/tip/1a763fd7c6335e3122c1cc09576ef6c99ada4267 Author: Juri Lelli AuthorDate: Fri, 19 Jul 2019 15:59:59 +0200 Committer: Ingo Molnar CommitDate: Thu, 25 Jul 2019 15:55:03 +0200 rcu/tree: Call setschedule() gp ktread to SCHED_FIFO outside of atomic region sched_setscheduler() needs to acquire cpuset_rwsem, but it is currently called from an invalid (atomic) context by rcu_spawn_gp_kthread(). Fix that by simply moving sched_setscheduler_nocheck() call outside of the atomic region, as it doesn't actually require to be guarded by rcu_node lock. Suggested-by: Peter Zijlstra Tested-by: Dietmar Eggemann Signed-off-by: Juri Lelli Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Thomas Gleixner Cc: bristot@redhat.com Cc: claudio@evidence.eu.com Cc: lizefan@huawei.com Cc: longman@redhat.com Cc: luca.abeni@santannapisa.it Cc: mathieu.poirier@linaro.org Cc: rostedt@goodmis.org Cc: tj@kernel.org Cc: tommaso.cucinotta@santannapisa.it Link: https://lkml.kernel.org/r/20190719140000.31694-8-juri.lelli@redhat.com Signed-off-by: Ingo Molnar --- kernel/rcu/tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index a14e5fbbea46..eb764c24bc4d 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3234,13 +3234,13 @@ static int __init rcu_spawn_gp_kthread(void) t = kthread_create(rcu_gp_kthread, NULL, "%s", rcu_state.name); if (WARN_ONCE(IS_ERR(t), "%s: Could not start grace-period kthread, OOM is now expected behavior\n", __func__)) return 0; + if (kthread_prio) + sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); rnp = rcu_get_root(); raw_spin_lock_irqsave_rcu_node(rnp, flags); rcu_state.gp_kthread = t; - if (kthread_prio) { + if (kthread_prio) sp.sched_priority = kthread_prio; - sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); - } raw_spin_unlock_irqrestore_rcu_node(rnp, flags); wake_up_process(t); rcu_spawn_nocb_kthreads();