From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mike Galbraith <efault@gmx.de>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org,
Valdis.Kletnieks@vt.edu, dhowells@redhat.com,
eric.dumazet@gmail.com, darren@dvhart.com, patches@linaro.org
Subject: Re: [PATCH tip/core/rcu 44/55] rcu: wire up RCU_BOOST_PRIO for rcutree
Date: Tue, 13 Sep 2011 08:34:13 -0700 [thread overview]
Message-ID: <20110913153413.GB2416@linux.vnet.ibm.com> (raw)
In-Reply-To: <1315915334.6300.15.camel@marge.simson.net>
On Tue, Sep 13, 2011 at 02:02:14PM +0200, Mike Galbraith wrote:
> Hi Paul,
>
> This patch causes RCU thread priority funnies, with some help from rcun.
>
> On Tue, 2011-09-06 at 11:00 -0700, Paul E. McKenney wrote:
> > return 0;
> > @@ -1466,6 +1474,7 @@ static void rcu_yield(void (*f)(unsigned long), unsigned long arg)
> > {
> > struct sched_param sp;
> > struct timer_list yield_timer;
> > + int prio = current->normal_prio;
> >
> > setup_timer_on_stack(&yield_timer, f, arg);
> > mod_timer(&yield_timer, jiffies + 2);
>
> There's a thinko there, prio either needs to be inverted before feeding
> it to __setscheduler().. or just use ->rt_priority. I did the latter,
> and twiddled rcun to restore it's priority instead of RCU_KTHREAD_PRIO.
> RCU threads now stay put.
Very good -- some comments below. I had to hand-apply this due to
conflicts with my current patch stack: https://github.com/paulmckrcu/linux
> rcu: wire up RCU_BOOST_PRIO for rcutree
>
> RCU boost threads start life at RCU_BOOST_PRIO, while others remain at
> RCU_KTHREAD_PRIO. Adjust rcu_yield() to preserve priority across the
> yield, and if the node thread restores RT policy for a yielding thread,
> it sets priority to it's own priority. This sets the stage for user
> controlled runtime changes to priority in the -rt tree.
>
> While here, change thread names to match other kthreads.
>
> Signed-off-by: Mike Galbraith <efault@gmx.de>
>
> ---
> kernel/rcutree.c | 2 --
> kernel/rcutree_plugin.h | 22 ++++++++++++++++------
> 2 files changed, 16 insertions(+), 8 deletions(-)
>
> Index: linux-3.0-tip/kernel/rcutree.c
> ===================================================================
> --- linux-3.0-tip.orig/kernel/rcutree.c
> +++ linux-3.0-tip/kernel/rcutree.c
> @@ -128,8 +128,6 @@ static void rcu_node_kthread_setaffinity
> static void invoke_rcu_core(void);
> static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp);
>
> -#define RCU_KTHREAD_PRIO 1 /* RT priority for per-CPU kthreads. */
> -
> /*
> * Track the rcutorture test sequence number and the update version
> * number within a given test. The rcutorture_testseq is incremented
> Index: linux-3.0-tip/kernel/rcutree_plugin.h
> ===================================================================
> --- linux-3.0-tip.orig/kernel/rcutree_plugin.h
> +++ linux-3.0-tip/kernel/rcutree_plugin.h
> @@ -27,6 +27,14 @@
> #include <linux/delay.h>
> #include <linux/stop_machine.h>
>
> +#define RCU_KTHREAD_PRIO 1
> +
> +#ifdef CONFIG_RCU_BOOST
> +#define RCU_BOOST_PRIO CONFIG_RCU_BOOST_PRIO
> +#else
> +#define RCU_BOOST_PRIO RCU_KTHREAD_PRIO
> +#endif
> +
> /*
> * Check the RCU kernel configuration parameters and print informative
> * messages about anything out of the ordinary. If you like #ifdef, you
> @@ -1345,13 +1353,13 @@ static int __cpuinit rcu_spawn_one_boost
> if (rnp->boost_kthread_task != NULL)
> return 0;
> t = kthread_create(rcu_boost_kthread, (void *)rnp,
> - "rcub%d", rnp_index);
> + "rcub/%d", rnp_index);
> if (IS_ERR(t))
> return PTR_ERR(t);
> raw_spin_lock_irqsave(&rnp->lock, flags);
> rnp->boost_kthread_task = t;
> raw_spin_unlock_irqrestore(&rnp->lock, flags);
> - sp.sched_priority = RCU_KTHREAD_PRIO;
> + sp.sched_priority = RCU_BOOST_PRIO;
> sched_setscheduler_nocheck(t, SCHED_FIFO, &sp);
> wake_up_process(t); /* get to TASK_INTERRUPTIBLE quickly. */
> return 0;
> @@ -1446,6 +1454,7 @@ static void rcu_yield(void (*f)(unsigned
> {
> struct sched_param sp;
> struct timer_list yield_timer;
> + int prio = current->rt_priority;
This makes sense, and I have merged it into your previous patch.
> setup_timer_on_stack(&yield_timer, f, arg);
> mod_timer(&yield_timer, jiffies + 2);
> @@ -1453,7 +1462,8 @@ static void rcu_yield(void (*f)(unsigned
> sched_setscheduler_nocheck(current, SCHED_NORMAL, &sp);
> set_user_nice(current, 19);
> schedule();
> - sp.sched_priority = RCU_KTHREAD_PRIO;
> + set_user_nice(current, 0);
> + sp.sched_priority = prio;
> sched_setscheduler_nocheck(current, SCHED_FIFO, &sp);
> del_timer(&yield_timer);
> }
> @@ -1562,7 +1572,7 @@ static int __cpuinit rcu_spawn_one_cpu_k
> if (!rcu_scheduler_fully_active ||
> per_cpu(rcu_cpu_kthread_task, cpu) != NULL)
> return 0;
> - t = kthread_create(rcu_cpu_kthread, (void *)(long)cpu, "rcuc%d", cpu);
> + t = kthread_create(rcu_cpu_kthread, (void *)(long)cpu, "rcuc/%d", cpu);
> if (IS_ERR(t))
> return PTR_ERR(t);
> if (cpu_online(cpu))
> @@ -1608,7 +1618,7 @@ static int rcu_node_kthread(void *arg)
> continue;
> }
> per_cpu(rcu_cpu_has_work, cpu) = 1;
> - sp.sched_priority = RCU_KTHREAD_PRIO;
> + sp.sched_priority = current->rt_priority;
This is broken -- the per-node kthread runs at RT prio 99, but we usually
would not want to boost that high.
Seems like we should have a global variable that tracks the current
priority. This global variable could then be set in a manner similar
to the softirq priorities -- or, perhaps better, simply set whenever
the softirq priority is changed.
Thoughts?
> sched_setscheduler_nocheck(t, SCHED_FIFO, &sp);
> preempt_enable();
> }
> @@ -1671,7 +1681,7 @@ static int __cpuinit rcu_spawn_one_node_
> return 0;
> if (rnp->node_kthread_task == NULL) {
> t = kthread_create(rcu_node_kthread, (void *)rnp,
> - "rcun%d", rnp_index);
> + "rcun/%d", rnp_index);
> if (IS_ERR(t))
> return PTR_ERR(t);
> raw_spin_lock_irqsave(&rnp->lock, flags);
>
>
next prev parent reply other threads:[~2011-09-13 15:40 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 18:00 [PATCH tip/core/rcu 0/55] Preview of RCU changes for 3.2 Paul E. McKenney
2011-09-06 17:59 ` [PATCH tip/core/rcu 01/55] rcu: Use kthread_create_on_node() Paul E. McKenney
2011-09-06 17:59 ` [PATCH tip/core/rcu 02/55] rcu: Avoid unnecessary self-wakeup of per-CPU kthreads Paul E. McKenney
2011-09-06 17:59 ` [PATCH tip/core/rcu 03/55] rcu: Update documentation to flag RCU_BOOST trace information Paul E. McKenney
2011-09-06 17:59 ` [PATCH tip/core/rcu 04/55] rcu: Restore checks for blocking in RCU read-side critical sections Paul E. McKenney
2011-09-06 17:59 ` [PATCH tip/core/rcu 05/55] rcu: Move rcu_head definition to types.h Paul E. McKenney
2011-09-07 18:31 ` Paul Gortmaker
2011-09-07 22:11 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 06/55] rcu: Update rcutorture documentation Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 07/55] rcu: Fix mismatched variable in rcutree_trace.c Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 08/55] rcu: Abstract common code for RCU grace-period-wait primitives Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 09/55] rcu: Catch rcutorture up to new RCU API additions Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 10/55] rcu: Fix RCU's NMI documentation Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 11/55] rcu: Drive configuration directly from SMP and PREEMPT Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 12/55] rcu: Fix pathnames in documentation Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 13/55] rcu: Don't destroy rcu_torture_boost() callback until it is done Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 14/55] rcu: Add event-tracing for RCU callback invocation Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 15/55] rcu: Event-trace markers for computing RCU CPU utilization Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 16/55] rcu: Put names into TINY_RCU structures under RCU_TRACE Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 17/55] rcu: Add RCU type to callback-invocation tracing Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 18/55] rcu: Update comments to reflect softirqs vs. kthreads Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 19/55] rcu: Move RCU_BOOST declarations to allow compiler checking Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 20/55] rcu: Add event-trace markers to TREE_RCU kthreads Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 21/55] rcu: Make TINY_RCU also use softirq for RCU_BOOST=n Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 22/55] rcu: Add grace-period, quiescent-state, and call_rcu trace events Paul E. McKenney
2011-10-17 1:33 ` Josh Triplett
2011-10-24 12:02 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 23/55] rcu: Simplify quiescent-state accounting Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 24/55] rcu: Not necessary to pass rcu_read_lock_held() to rcu_dereference_protected() Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 25/55] rcu: Update documentation for additional RCU lockdep functions Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 26/55] rcu: Remove unused and redundant interfaces Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 27/55] rcu: Allow rcutorture's stat_interval parameter to be changed at runtime Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 28/55] rcu: Document interpretation of RCU-lockdep splats Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 29/55] nohz: Remove nohz_cpu_mask Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 30/55] rcu: Eliminate in_irq() checks in rcu_enter_nohz() Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 31/55] rcu: Make rcu_implicit_dynticks_qs() locals be correct size Paul E. McKenney
2011-10-17 1:43 ` Josh Triplett
2011-10-24 12:00 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 32/55] rcu: Make rcu_assign_pointer() unconditionally insert a memory barrier Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 33/55] rcu: Improve rcu_assign_pointer() and RCU_INIT_POINTER() documentation Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 34/55] rcu: Move __rcu_read_unlock()'s barrier() within if-statement Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 35/55] rcu: Dump local stack if cannot dump all CPUs' stacks Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 36/55] rcu: Prevent early boot set_need_resched() from __rcu_pending() Paul E. McKenney
2011-10-17 1:49 ` Josh Triplett
2011-10-24 12:07 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 37/55] rcu: Simplify unboosting checks Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 38/55] rcu: Prohibit grace periods during early boot Paul E. McKenney
2011-10-17 1:51 ` Josh Triplett
2011-09-06 18:00 ` [PATCH tip/core/rcu 39/55] rcu: Suppress NMI backtraces when stall ends before dump Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 40/55] rcu: Avoid having just-onlined CPU resched itself when RCU is idle Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 41/55] rcu: Permit rt_mutex_unlock() with irqs disabled Paul E. McKenney
2011-09-18 4:09 ` Yong Zhang
2011-09-19 4:14 ` Paul E. McKenney
2011-09-19 5:49 ` Yong Zhang
2011-09-20 14:57 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 42/55] rcu: Make rcu_torture_fqs() exit loops at end of test Paul E. McKenney
2011-10-17 1:53 ` Josh Triplett
2011-10-24 12:10 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 43/55] rcu: Make rcu_torture_boost() " Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 44/55] rcu: wire up RCU_BOOST_PRIO for rcutree Paul E. McKenney
2011-09-13 12:02 ` Mike Galbraith
2011-09-13 15:34 ` Paul E. McKenney [this message]
2011-09-13 16:04 ` Mike Galbraith
2011-09-13 20:50 ` Paul E. McKenney
2011-10-17 1:55 ` Josh Triplett
2011-09-06 18:00 ` [PATCH tip/core/rcu 45/55] rcu: check for entering dyntick-idle mode while in read-side critical section Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 46/55] rcu: Remove rcu_needs_cpu_flush() to avoid false quiescent states Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 47/55] rcu: Move propagation of ->completed from rcu_start_gp() to rcu_report_qs_rsp() Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 48/55] powerpc: strengthen value-returning-atomics memory barriers Paul E. McKenney
2011-09-09 17:23 ` Olof Johansson
2011-09-09 17:34 ` Paul E. McKenney
2011-09-09 18:43 ` Olof Johansson
2011-09-06 18:00 ` [PATCH tip/core/rcu 49/55] rcu: Detect illegal rcu dereference in extended quiescent state Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 50/55] rcu: Inform the user about dynticks-idle mode on PROVE_RCU warning Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 51/55] rcu: Warn when rcu_read_lock() is used in extended quiescent state Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 52/55] rcu: Remove one layer of abstraction from PROVE_RCU checking Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 53/55] rcu: Warn when srcu_read_lock() is used in an extended quiescent state Paul E. McKenney
2011-10-04 21:03 ` Frederic Weisbecker
2011-10-04 23:40 ` Paul E. McKenney
2011-10-04 23:42 ` Frederic Weisbecker
2011-09-06 18:00 ` [PATCH tip/core/rcu 54/55] rcu: Make srcu_read_lock_held() call common lockdep-enabled function Paul E. McKenney
2011-10-17 2:03 ` Josh Triplett
2011-10-24 12:34 ` Paul E. McKenney
2011-09-06 18:00 ` [PATCH tip/core/rcu 55/55] powerpc: Work around tracing from dyntick-idle mode Paul E. McKenney
2011-09-07 10:00 ` Benjamin Herrenschmidt
2011-09-07 13:44 ` Paul E. McKenney
2011-09-13 19:13 ` Frederic Weisbecker
2011-09-13 19:50 ` Paul E. McKenney
2011-09-13 20:49 ` Benjamin Herrenschmidt
2011-09-15 14:53 ` Frederic Weisbecker
2011-09-16 12:24 ` Frederic Weisbecker
2011-09-07 14:39 ` [PATCH tip/core/rcu 0/55] Preview of RCU changes for 3.2 Lin Ming
2011-09-08 17:41 ` Paul E. McKenney
2011-09-08 19:23 ` Thomas Gleixner
2011-09-08 20:48 ` Paul E. McKenney
2011-09-12 16:24 ` Paul E. McKenney
2011-10-17 2:06 ` Josh Triplett
2011-10-24 12:35 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110913153413.GB2416@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=efault@gmx.de \
--cc=eric.dumazet@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=patches@linaro.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).