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

Commit 0cdc29e2 authored by Lingutla Chandrasekhar's avatar Lingutla Chandrasekhar Committed by Gerrit - the friendly Code Review server
Browse files

sched: rt: Use RCU lock in rt task cpu select path



RT energy aware cpu selection tries to get cpu idle state
without holding rcu read lock, it may get stale/corrupted value.

Fix it by moving rcu unlock to end for energy aware cpu
selection.

Change-Id: Ia219062db6b97b9a44681647cea077c45c29cff2
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 071be09f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1805,7 +1805,6 @@ static int find_lowest_rq(struct task_struct *task)
				}
			}
		} while (sg = sg->next, sg != sd->groups);
		rcu_read_unlock();

		if (sg_target) {
			cpumask_and(&search_cpu, lowest_mask,
@@ -1894,6 +1893,7 @@ static int find_lowest_rq(struct task_struct *task)
		}

		if (best_cpu != -1 && placement_boost != SCHED_BOOST_ON_ALL) {
			rcu_read_unlock();
			return best_cpu;
		} else if (!cpumask_empty(&backup_search_cpu)) {
			cpumask_copy(&search_cpu, &backup_search_cpu);
@@ -1902,6 +1902,7 @@ static int find_lowest_rq(struct task_struct *task)
			placement_boost = SCHED_BOOST_NONE;
			goto retry;
		}
		rcu_read_unlock();
	}

noea: