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

Commit 9cd9be84 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched: drop related_thread_group_lock before calling call_rcu()



When the last task is removed from a related thread group, the
group is freed by invoking an asynchronous RCU callback. The
call_rcu() can wakeup rcu, kswapd tasks. Hence drop the
related thread group lock, otherwise the wakeup path tries
to acquire the same lock and results in deadlock.

Change-Id: Idfb38a0276edbf6816369b3bab7f21bef5ccc556
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent a3c6f163
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3964,7 +3964,14 @@ static void remove_task_from_group(struct task_struct *p)

	if (empty_group) {
		list_del(&grp->list);
		/*
		 * RCU, kswapd etc tasks can get woken up from
		 * call_rcu(). As the wakeup path also acquires
		 * the related_thread_group_lock, drop it here.
		 */
		write_unlock(&related_thread_group_lock);
		call_rcu(&grp->rcu, free_related_thread_group);
		write_lock(&related_thread_group_lock);
	}
}