From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: Re: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
Date: Thu, 21 Jan 2016 13:54:05 +0100 [thread overview]
Message-ID: <20160121125405.GA11749@linutronix.de> (raw)
In-Reply-To: <1453170597.3740.7.camel@gmail.com>
* Mike Galbraith | 2016-01-19 03:29:57 [+0100]:
>> And this is a new piece. So you forbid that tasks leave the CPU if
>> lazy_count > 0. Let me look closed why this is happening and if this is
>> v4.1 … v4.4 or not.
>
>We should probably just add the lazy bits to preemptible().
Subject: preempt-lazy: Add the lazy-preemption check to preempt_schedule()
Probably in the rebase onto v4.1 this check got moved into less commonly used
preempt_schedule_notrace(). This patch ensures that both functions use it.
Reported-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/sched/core.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3461,6 +3461,30 @@ static void __sched notrace preempt_sche
} while (need_resched());
}
+#ifdef CONFIG_PREEMPT_LAZY
+/*
+ * If TIF_NEED_RESCHED is then we allow to be scheduled away since this is
+ * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as
+ * preempt_lazy_count counter >0.
+ */
+static int preemptible_lazy(void)
+{
+ if (test_thread_flag(TIF_NEED_RESCHED))
+ return 1;
+ if (current_thread_info()->preempt_lazy_count)
+ return 0;
+ return 1;
+}
+
+#else
+
+static int preemptible_lazy(void)
+{
+ return 1;
+}
+
+#endif
+
#ifdef CONFIG_PREEMPT
/*
* this is the entry point to schedule() from in-kernel preemption
@@ -3475,6 +3499,8 @@ asmlinkage __visible void __sched notrac
*/
if (likely(!preemptible()))
return;
+ if (!preemptible_lazy())
+ return;
preempt_schedule_common();
}
@@ -3501,15 +3527,9 @@ asmlinkage __visible void __sched notrac
if (likely(!preemptible()))
return;
-
-#ifdef CONFIG_PREEMPT_LAZY
- /*
- * Check for lazy preemption
- */
- if (current_thread_info()->preempt_lazy_count &&
- !test_thread_flag(TIF_NEED_RESCHED))
+ if (!preemptible_lazy())
return;
-#endif
+
do {
preempt_disable_notrace();
/*
next prev parent reply other threads:[~2016-01-21 12:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 9:08 [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
2016-01-18 20:18 ` Sebastian Andrzej Siewior
2016-01-19 2:29 ` Mike Galbraith
2016-01-19 2:29 ` Mike Galbraith
2016-01-21 12:54 ` Sebastian Andrzej Siewior [this message]
2016-01-22 12:24 ` Grygorii Strashko
2016-01-22 12:24 ` Grygorii Strashko
2016-01-22 13:19 ` Sebastian Andrzej Siewior
2016-01-22 13:34 ` Grygorii Strashko
2016-01-22 14:14 ` Sebastian Andrzej Siewior
2016-01-22 15:04 ` Grygorii Strashko
2016-01-22 18:21 ` Grygorii Strashko
2016-02-21 15:11 ` [patch] sched,rt: __always_inline preemptible_lazy() Mike Galbraith
2016-01-19 4:41 ` [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Mike Galbraith
2016-01-19 4:41 ` Mike Galbraith
2016-01-19 5:14 ` Mike Galbraith
2016-01-19 5:14 ` Mike Galbraith
2016-01-22 11:58 ` Grygorii Strashko
2016-01-22 11:58 ` Grygorii Strashko
2016-01-22 12:54 ` Sebastian Andrzej Siewior
2016-01-22 12:54 ` Sebastian Andrzej Siewior
2016-01-22 20:40 ` Sebastian Andrzej Siewior
2016-01-25 17:14 ` Grygorii Strashko
2016-02-01 13:04 ` Sebastian Andrzej Siewior
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=20160121125405.GA11749@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.