Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cba6d0d6 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

Revert "rcu: Move PREEMPT_RCU preemption to switch_to() invocation"



This reverts commit 616c310e.
(Move PREEMPT_RCU preemption to switch_to() invocation).
Testing by Sasha Levin <levinsasha928@gmail.com> showed that this
can result in deadlock due to invoking the scheduler when one of
the runqueue locks is held.  Because this commit was simply a
performance optimization, revert it.

Reported-by: default avatarSasha Levin <levinsasha928@gmail.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: default avatarSasha Levin <levinsasha928@gmail.com>
parent 6887a413
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -705,7 +705,6 @@ static void stack_proc(void *arg)
	struct task_struct *from = current, *to = arg;

	to->thread.saved_task = from;
	rcu_switch_from(from);
	switch_to(from, to, from);
}

+0 −1
Original line number Diff line number Diff line
@@ -184,7 +184,6 @@ static inline int rcu_preempt_depth(void)
/* Internal to kernel */
extern void rcu_sched_qs(int cpu);
extern void rcu_bh_qs(int cpu);
extern void rcu_preempt_note_context_switch(void);
extern void rcu_check_callbacks(int cpu, int user);
struct notifier_block;
extern void rcu_idle_enter(void);
+6 −0
Original line number Diff line number Diff line
@@ -87,6 +87,10 @@ static inline void kfree_call_rcu(struct rcu_head *head,

#ifdef CONFIG_TINY_RCU

static inline void rcu_preempt_note_context_switch(void)
{
}

static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
{
	*delta_jiffies = ULONG_MAX;
@@ -95,6 +99,7 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)

#else /* #ifdef CONFIG_TINY_RCU */

void rcu_preempt_note_context_switch(void);
int rcu_preempt_needs_cpu(void);

static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
@@ -108,6 +113,7 @@ static inline int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies)
static inline void rcu_note_context_switch(int cpu)
{
	rcu_sched_qs(cpu);
	rcu_preempt_note_context_switch();
}

/*
+0 −10
Original line number Diff line number Diff line
@@ -1871,22 +1871,12 @@ static inline void rcu_copy_process(struct task_struct *p)
	INIT_LIST_HEAD(&p->rcu_node_entry);
}

static inline void rcu_switch_from(struct task_struct *prev)
{
	if (prev->rcu_read_lock_nesting != 0)
		rcu_preempt_note_context_switch();
}

#else

static inline void rcu_copy_process(struct task_struct *p)
{
}

static inline void rcu_switch_from(struct task_struct *prev)
{
}

#endif

#ifdef CONFIG_SMP
+1 −0
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ void rcu_note_context_switch(int cpu)
{
	trace_rcu_utilization("Start context switch");
	rcu_sched_qs(cpu);
	rcu_preempt_note_context_switch(cpu);
	trace_rcu_utilization("End context switch");
}
EXPORT_SYMBOL_GPL(rcu_note_context_switch);
Loading