From: Christoph Lameter Date: Sun, 10 Dec 2006 10:20:13 +0000 (-0800) Subject: [PATCH] sched: avoid taking rq lock in wake_priority_sleeper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=571f6d2fb0b1c04798df783db2ba85e96bcce43d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] sched: avoid taking rq lock in wake_priority_sleeper Avoid taking the request queue lock in wake_priority_sleeper if there are no running processes. Signed-off-by: Christoph Lameter Cc: Peter Williams Cc: Nick Piggin Cc: Christoph Lameter Cc: "Siddha, Suresh B" Cc: "Chen, Kenneth W" Cc: KAMEZAWA Hiroyuki Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/sched.c b/kernel/sched.c index f04add905bdf..fdd26fffaa20 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -2915,6 +2915,9 @@ static inline int wake_priority_sleeper(struct rq *rq) int ret = 0; #ifdef CONFIG_SCHED_SMT + if (!rq->nr_running) + return 0; + spin_lock(&rq->lock); /* * If an SMT sibling task has been put to sleep for priority