Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled

From: Peter Zijlstra
Date: Wed Jun 15 2016 - 18:15:31 EST


On Wed, Jun 15, 2016 at 02:46:10PM -0700, Paul E. McKenney wrote:
> Currently, if the very first call to call_rcu_tasks() has irqs disabled,
> it will create the rcu_tasks_kthread with irqs disabled, which will
> result in a splat in the memory allocator, which kthread_run() invokes
> with the expectation that irqs are enabled.
>
> This commit fixes this problem by deferring kthread creation if called
> with irqs disabled. The first call to call_rcu_tasks() that has irqs
> enabled will create the kthread.
>
> This bug was detected by rcutorture changes that were motivated by
> Iftekhar Ahmed's mutation-testing efforts.
>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 218f8e83db73..4a3b279beb42 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2175,7 +2175,7 @@ void task_numa_free(struct task_struct *p)
>
> grp->nr_tasks--;
> spin_unlock_irqrestore(&grp->lock, flags);
> - RCU_INIT_POINTER(p->numa_group, NULL);
> + rcu_assign_pointer(p->numa_group, NULL);
> put_numa_group(grp);
> }

This seems entirely unrelated; albeit desired given that other patch.