linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kirill Tkhai <tkhai@yandex.ru>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Subject: [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks()
Date: Mon, 28 Jan 2013 03:46:48 +0400	[thread overview]
Message-ID: <2016751359330408@web20f.yandex.ru> (raw)

The patch aims to decrease the number of calls of push_rt_task()
in push_rt_tasks().

It's not necessary to push more than 'num_online_cpus() - 1' tasks.
If just pushed task doesn't leave its new CPU during our local call
of push_rt_tasks() than we won't push another task to the CPU.
If it leave or change priority than it will pull new task by itself.

Signed-off-by: Kirill V Tkhai <tkhai@yandex.ru>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Peter Zijlstra <peterz@infradead.org>
CC: linux-rt-users <linux-rt-users@vger.kernel.org>
---
 kernel/sched/rt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4e8f0f4..edf046d 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1703,8 +1703,10 @@ out:
 
 static void push_rt_tasks(struct rq *rq)
 {
+	int num_cpus = num_online_cpus() - 1;
+
 	/* push_rt_task will return true if it moved an RT */
-	while (push_rt_task(rq))
+	while (push_rt_task(rq) && --num_cpus > 0)
 		;
 }
 

             reply	other threads:[~2013-01-27 23:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 23:46 Kirill Tkhai [this message]
2013-01-31 16:08 ` [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks() Steven Rostedt
2013-01-31 21:57   ` Kirill Tkhai
2013-02-05  3:37     ` Honghui Zhang
  -- strict thread matches above, loose matches on Subject: below --
2013-02-05  7:22 Kirill Tkhai
2013-02-05  8:25 ` [PATCH] " Honghui Zhang

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=2016751359330408@web20f.yandex.ru \
    --to=tkhai@yandex.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).