Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4805309imm; Mon, 18 Jun 2018 23:35:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJCsXFYrWntduplewo9XAeBBDhP5e6zNKhNywgEIkkAAF1hKEU3i2dao3i9tKnba754S1jR X-Received: by 2002:a17:902:9a95:: with SMTP id w21-v6mr17388325plp.168.1529390117386; Mon, 18 Jun 2018 23:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529390117; cv=none; d=google.com; s=arc-20160816; b=g01krmRuvr4Y6OPQDI4JiTN/Ki7+KRgxg0+0Is3KQ9RmT8wkCLrxpNlGt4/BSGAkLk hfykiFLebTMHQ1trJVawJ9CE7SqSiqlfy180Reawfp6J67Y/OqwLlv4lqGLO64/EHcFg k+fEsMkh7RrJTkSFEkavjub7ffs4crlV+xPTQYADSP16VkIKG5/EpHlOmdOAzJRh1RTV NI1t1KvCmgZYZCwMNMQ2cMWDYyb3HKJX/UVobyAqDxFwwGZsL+vkIWNOudY/Ls+3hkua CBWMS9ZBKemlKRvwIrqGA1CgIETBarBgJ4lmNZZ+JyWcTEqiXMng9IgUa4Gg4fKEBBAe vPvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=vYm79VAUitHC3cX1Dn2t4UMwjK5wJvxtsHjQGVTlMT8=; b=GGTTthdTkzrioHA3JdLroc6xDoKl2xpwAefP3BwTdyPd44y01RiRvZjrcdd5Tx1XG8 C8OenR4vjjNL0WC/eWsKLx+NbmyxFkRVJUr1+q8zL9LXshNsHCaOYAv1ODYhhqpgXTRJ hGkSQCxxfGdN2IRgAFwQwj7GnvJFJ0j9650mJc7hQyyNgYJ87pT0eBH1y95zvZpIirew n9FQtl6+XwF1a5Ho6n5Vm2VXKaykc0ZiGts3HEhGxcaJJ9BgYuZ/MFssM229BHkROyxA OowBeeFhN9vlJPUcFcA9SntDjtQeB05Hc3bFqbwaUQh313eHugO03Z04bVeHXbPO+ugk jBCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=t6auXQDS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10-v6si11874891pgv.1.2018.06.18.23.35.02; Mon, 18 Jun 2018 23:35:17 -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=@joelfernandes.org header.s=google header.b=t6auXQDS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755975AbeFSGeY (ORCPT + 99 others); Tue, 19 Jun 2018 02:34:24 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:34698 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbeFSGeW (ORCPT ); Tue, 19 Jun 2018 02:34:22 -0400 Received: by mail-pl0-f68.google.com with SMTP id g20-v6so10396478plq.1 for ; Mon, 18 Jun 2018 23:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vYm79VAUitHC3cX1Dn2t4UMwjK5wJvxtsHjQGVTlMT8=; b=t6auXQDSGptYtUSIJ9+UrwBXkCYU5nm+XE6mn2iKVx8yhY8N4PpPn9iEq6WW/hFOwc /sdvio1tn4QpxdZfw9mmi5t2eVtO85bY0iA7FaxlQndm2CwwrJ/pZLrVT/JVYig2ep+6 MbKZe0kUShqWYhiYPaKiZcMffBomQvnwCBoMU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vYm79VAUitHC3cX1Dn2t4UMwjK5wJvxtsHjQGVTlMT8=; b=iNEgIrYizzC2V9R6QNvKRRyYT96cOBfxmGBtJcyllErJbDqX4JKEu7E5ttW5zCgX6y Jrq2fnrlw66LmZMmMYiJdoC2R3JgGCdrjmEKcfhnjdLZS3sOUR5JNMuy9pz/GQsS3PdM MioeUyCJgTW4oLqm+boTiRb5+AMDGH2Wsq2euo0UajuMiVggEn2aL4D+ml3d3vCPJ2YS GcZyadDSKgII87gh2bozV+T/lUonm3NSSGD2mWe9dQnRt55+qmVktGMBFfAzOXHkS40Q E76pJITiWLjhj6kKyEpyVot6IfduPBqp+RcRIVI8WznoWXI9ZIgqXc6suXxO2niFoEOM Ik1g== X-Gm-Message-State: APt69E2z0RxvxcKM10KsT16CTl3kxzwf2w1zV6VX4Bw48K3/2x17P6ZT NUHLDQl67wcmrbLETL/oFQox22fK6/U= X-Received: by 2002:a17:902:b683:: with SMTP id c3-v6mr17435664pls.158.1529390062260; Mon, 18 Jun 2018 23:34:22 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id k12-v6sm5024784pff.31.2018.06.18.23.34.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 23:34:21 -0700 (PDT) Date: Mon, 18 Jun 2018 23:34:21 -0700 From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt , Byungchul Park Subject: Re: [PATCH 1/2] rcu: Assign higher priority to RCU threads if its rcutorture Message-ID: <20180619063421.GA221670@joelaf.mtv.corp.google.com> References: <20180619062215.221564-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180619062215.221564-1-joel@joelfernandes.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 11:22:14PM -0700, Joel Fernandes wrote: > From: "Joel Fernandes (Google)" > > rcutorture boost tests fail even with CONFIG_RCU_BOOST set because > rcutorture's threads are equal priority to the default RCU kthreads (RT > class with priority of 1). Sorry for the weird subject line, I meant "rcu: Assign higher prio if rcutorture is built into kernel". I have included the patch with the subject line fixed up below (if you prefer to take that instead). Also one question, incase rcutorture is a module, we can't raise the priority of the kthreads because it would be too late to do at module load time. In this case, do you have any ideas on what we can do? I was thinking we can access the kernel command line from within rcutorture module and check if 'rcutree.kthread_prio' was passed. And if it is and isn't sufficiently high, then we avoid testing boost feature at all (and print a nice message telling the user about the issue). OTOH, we can just let rcutorture module loaders fail the test if you feel very few automation tests do the module loading way of rcutorture and so a boost test failure there is tolerable. For me, I will likely be running rcutorture only as a built-in so I am Ok with not special casing it within rcutorture. thanks! - Joel -----8<--------- From 8cb7c2ac98e510abac35fdf2419a3212a587095a Mon Sep 17 00:00:00 2001 From: "Joel Fernandes (Google)" Date: Mon, 18 Jun 2018 15:13:10 -0700 Subject: [PATCH 1/2] rcu: Assign higher prio if rcutorture is built into kernel rcutorture boost tests fail even with CONFIG_RCU_BOOST set because rcutorture's threads are equal priority to the default RCU kthreads (RT class with priority of 1). This patch checks if RCU torture is built into the kernel and if so, assigns a higher priority to the RCU threads. With this the rcutorture boost tests pass. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index deb2508be923..a141d6314622 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -171,7 +171,7 @@ static void rcu_report_exp_rdp(struct rcu_state *rsp, static void sync_sched_exp_online_cleanup(int cpu); /* rcuc/rcub kthread realtime priority */ -static int kthread_prio = IS_ENABLED(CONFIG_RCU_BOOST) ? 1 : 0; +static int kthread_prio; module_param(kthread_prio, int, 0644); /* Delay in jiffies for grace-period initialization delays, debug only. */ @@ -3884,12 +3884,16 @@ static int __init rcu_spawn_gp_kthread(void) struct task_struct *t; /* Force priority into range. */ - if (IS_ENABLED(CONFIG_RCU_BOOST) && kthread_prio < 1) + if (IS_ENABLED(CONFIG_RCU_BOOST) && kthread_prio < 2 + && IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)) + kthread_prio = 2; + else if (IS_ENABLED(CONFIG_RCU_BOOST) && kthread_prio < 1) kthread_prio = 1; else if (kthread_prio < 0) kthread_prio = 0; else if (kthread_prio > 99) kthread_prio = 99; + if (kthread_prio != kthread_prio_in) pr_alert("rcu_spawn_gp_kthread(): Limited prio to %d from %d\n", kthread_prio, kthread_prio_in); -- 2.18.0.rc1.244.gcf134e6275-goog