linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Galbraith <umgwanakikbuti@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port
Date: Mon, 18 Jan 2016 10:08:23 +0100	[thread overview]
Message-ID: <1453108103.4123.4.camel@gmail.com> (raw)


pre:
preempt lazy enabled
homer:/root # taskset -c 7 pipe-test 1
2.618038 usecs/loop -- avg 2.618038 763.9 KHz
2.620658 usecs/loop -- avg 2.618300 763.9 KHz
2.618775 usecs/loop -- avg 2.618347 763.8 KHz
2.618819 usecs/loop -- avg 2.618395 763.8 KHz
2.619269 usecs/loop -- avg 2.618482 763.8 KHz

tbench
Throughput 2612.9 MB/sec 8 procs

preempt lazy disabled
homer:/root # taskset -c 7 pipe-test 1
1.771921 usecs/loop -- avg 1.771921 1128.7 KHz
1.782686 usecs/loop -- avg 1.772998 1128.0 KHz
1.785444 usecs/loop -- avg 1.774242 1127.2 KHz
1.787388 usecs/loop -- avg 1.775557 1126.4 KHz
1.770772 usecs/loop -- avg 1.775078 1126.7 KHz

tbench
Throughput 2626.91 MB/sec 8 procs

post:
preempt lazy enabled
homer:/root # taskset -c 7 pipe-test 1
1.485592 usecs/loop -- avg 1.485592 1346.3 KHz
1.489640 usecs/loop -- avg 1.485997 1345.9 KHz
1.488325 usecs/loop -- avg 1.486230 1345.7 KHz
1.484632 usecs/loop -- avg 1.486070 1345.8 KHz
1.484889 usecs/loop -- avg 1.485952 1345.9 KHz

tbench
Throughput 3091.84 MB/sec 8 procs

preempt lazy disabled
homer:/root # taskset -c 7 pipe-test 1
1.579723 usecs/loop -- avg 1.579723 1266.0 KHz
1.562026 usecs/loop -- avg 1.577953 1267.5 KHz
1.546090 usecs/loop -- avg 1.574767 1270.0 KHz
1.543852 usecs/loop -- avg 1.571675 1272.5 KHz
1.546313 usecs/loop -- avg 1.569139 1274.6 KHz

tbench
Throughput 2649.65 MB/sec 8 procs

Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
---
 arch/x86/entry/common.c |    4 ++--
 kernel/sched/core.c     |    9 +++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -220,14 +220,14 @@ long syscall_trace_enter(struct pt_regs
 
 #define EXIT_TO_USERMODE_LOOP_FLAGS				\
 	(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |	\
-	 _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY)
+	 _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY)
 
 static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags)
 {
 	/*
 	 * In order to return to user mode, we need to have IRQs off with
 	 * none of _TIF_SIGPENDING, _TIF_NOTIFY_RESUME, _TIF_USER_RETURN_NOTIFY,
-	 * _TIF_UPROBE, or _TIF_NEED_RESCHED set.  Several of these flags
+	 * _TIF_UPROBE, or _TIF_NEED_RESCHED_MASK set.  Several of these flags
 	 * can be set at any time on preemptable kernels if we have IRQs on,
 	 * so we need to loop.  Disabling preemption wouldn't help: doing the
 	 * work to clear some of the flags can sleep.
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3542,6 +3542,15 @@ 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))
+		return;
+#endif
+
 	preempt_schedule_common();
 }
 NOKPROBE_SYMBOL(preempt_schedule);

             reply	other threads:[~2016-01-18  9:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  9:08 Mike Galbraith [this message]
2016-01-18 20:18 ` [rfc patch v4.4-rt2] sched: fix up preempt lazy forward port Sebastian Andrzej Siewior
2016-01-19  2:29   ` Mike Galbraith
2016-01-21 12:54     ` Sebastian Andrzej Siewior
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  5:14     ` Mike Galbraith
2016-01-22 11:58   ` Grygorii Strashko
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=1453108103.4123.4.camel@gmail.com \
    --to=umgwanakikbuti@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).