mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org
Subject: [PATCH 2/3] sched/fair: Prevent active LB from preempting higher sched classes
Date: Wed,  7 Aug 2019 18:40:25 +0100	[thread overview]
Message-ID: <20190807174026.31242-3-valentin.schneider@arm.com> (raw)
In-Reply-To: <20190807174026.31242-1-valentin.schneider@arm.com>

The CFS load balancer can cause the cpu_stopper to run a function to
try and steal a rq's currently running task. However, it so happens
that while only CFS tasks will ever be migrated by that function, we
can end up preempting higher sched class tasks, since it is executed
by the cpu_stopper.

I don't expect this to be exceedingly common: we still need to have
had a busiest group in the first place, which needs

  busiest->sum_nr_running != 0

which is a cfs.h_nr_running sum, so we should have something to pull,
but if we fail to pull anything and the remote rq is executing
an RT/DL task we can hit this.

Add an extra check to not trigger the cpu_stopper if the remote
rq's running task isn't CFS.

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
---
 kernel/sched/fair.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b56b8edee3d3..79bd6ead589c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8834,6 +8834,10 @@ static inline enum alb_status active_load_balance(struct lb_env *env)
 
 	raw_spin_lock_irqsave(&busiest->lock, flags);
 
+	/* Make sure we're not about to stop a task from a higher sched class */
+	if (busiest->curr->sched_class != &fair_sched_class)
+		goto unlock;
+
 	/*
 	 * Don't kick the active_load_balance_cpu_stop, if the curr task on
 	 * busiest CPU can't be moved to dst_cpu:
--
2.22.0


  parent reply	other threads:[~2019-08-07 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 17:40 [PATCH 0/3] sched/fair: Active balancer RT/DL preemption fix Valentin Schneider
2019-08-07 17:40 ` [PATCH 1/3] sched/fair: Move active balance logic to its own function Valentin Schneider
2019-08-07 17:40 ` Valentin Schneider [this message]
2019-08-08  9:24   ` [PATCH 2/3] sched/fair: Prevent active LB from preempting higher sched classes Qais Yousef
2019-08-08 10:46     ` Valentin Schneider
2019-08-07 17:40 ` [PATCH 3/3] sched/fair: Check for CFS tasks in active_load_balance_cpu_stop() Valentin Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190807174026.31242-3-valentin.schneider@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®