Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3827442ybi; Fri, 19 Jul 2019 09:42:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGH0W6mtitVFIXPtZpklkHQZV/ScaN0jrvufNItApXyTfjvu4r/qsbAbxA7mGFpl0jxHb0 X-Received: by 2002:a17:902:900a:: with SMTP id a10mr58718441plp.281.1563554575182; Fri, 19 Jul 2019 09:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563554575; cv=none; d=google.com; s=arc-20160816; b=LEX71YDqPVAc5nUTunzoeX3vaZ6EOcaMpm5NcmmQELzJJxcbjb4uqIy7CH2oC8oBW7 YfOKADdFuJTvqwHFJ1eFar4T00GuiFpJgOLO1skZeTLpbz8Pbg7pqFx2mcOB8RBrTYEs zQRAPRs0+lTqK2oB+mE2laKdX2PD5jKMxJKkYlzPOugmjg/d9jlUUPBT5jvmkEUTvIbe eE9nbOIrU1qf7jYK1OqfaGOwGGy83UMaspCjLQ2XvXcbnG+YCZ9VxMyLHlluB9qVm4hh oEXH0ncdubL1e6EmGHYiw6mYLgGnU4OkIXqff4NjiW3gBbTeZyb7j8Hygqs9cu/Gsjtu n8EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=CCKTOX94dJMJaIi336ahfQwlG37S0yGGcCoKC+X5aD4=; b=SzpdMKyrxn8+KcGDtbg/BPbfFP4Mv2wuZeeYkKDj8q3tkjFnGZI9o5vQrvJwHK2nbl dzeN1QFE3+Df1VWDh56U8h8PSNFUytGRdcIKz4V3Ml5WJO+6m0+t9oRdohDKZJNq89F9 slZFGSk/3KFkLkU707Ge0mTZcx8o/rj8tviv33jkwYxoWQa4/ffGqE1smavRyT8f/cDS EuCLRMSHbU0ydEEA8HmyWHa/XelMijXAXeiuSzLnbhzDlArF8kl1mkcb7WwCDCq6t7FW ltBrHOseg3Ev7DKjacN/fBILQhdWQUd9JGIS9TL1hbHgO65Lxznn93ldeWi3OFvNHhCG bR9g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m127si989442pgm.100.2019.07.19.09.42.28; Fri, 19 Jul 2019 09:42:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729673AbfGSOAm (ORCPT + 99 others); Fri, 19 Jul 2019 10:00:42 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:45430 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729581AbfGSOAi (ORCPT ); Fri, 19 Jul 2019 10:00:38 -0400 Received: by mail-wr1-f68.google.com with SMTP id f9so32346923wre.12 for ; Fri, 19 Jul 2019 07:00:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CCKTOX94dJMJaIi336ahfQwlG37S0yGGcCoKC+X5aD4=; b=J0dJHnyQtAu6xdP9zw+fKZfP/AjLVaf6m7b7zy4HgWZj3FHbdF8tjHZzh5SWciMHiM 8P8/HKialx3316zsDC0idjdkPVH9xGBu5+bwfidXOmZsaFi6qygRddXVPc91ZDp4+/66 nzitTP7LtqgdPkHsgZCKIjm7eiCSuFfR6NZ5idR5XLxmQaLgvAQh1kuEkTD0E7KGLs/B 6zE+W0viX4pC+FFgzwG7eGYhSV+8kMpddMVT6ZZ5HlAStIi5zZXSS7j6yyr450jwQe/k SWheto8mj8UmuWWU7Eq25ZfCBhc+i11Hn4aeZSq9dvLDk1+eoiyYt9x6kX1VCnhPenI1 u2Sg== X-Gm-Message-State: APjAAAXw5Je7/e7Hyr/hZA/S09ObEnfr8zhP7YXR/d9xchcz+I+lLhWn wPAAPdX7blykYYZOFvi+zTk8mA== X-Received: by 2002:a5d:6408:: with SMTP id z8mr41366942wru.246.1563544836142; Fri, 19 Jul 2019 07:00:36 -0700 (PDT) Received: from localhost.localdomain.com ([151.15.230.231]) by smtp.gmail.com with ESMTPSA id f10sm21276926wrs.22.2019.07.19.07.00.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jul 2019 07:00:35 -0700 (PDT) From: Juri Lelli To: peterz@infradead.org, mingo@redhat.com, rostedt@goodmis.org, tj@kernel.org Cc: linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, lizefan@huawei.com, longman@redhat.com, dietmar.eggemann@arm.com, cgroups@vger.kernel.org, Juri Lelli Subject: [PATCH v9 7/8] rcu/tree: Setschedule gp ktread to SCHED_FIFO outside of atomic region Date: Fri, 19 Jul 2019 15:59:59 +0200 Message-Id: <20190719140000.31694-8-juri.lelli@redhat.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190719140000.31694-1-juri.lelli@redhat.com> References: <20190719140000.31694-1-juri.lelli@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Juri Lelli --- 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 980ca3ca643f..32ea75acba14 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3123,13 +3123,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(); -- 2.17.2