linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: umgwanakikbuti@gmail.com, mingo@elte.hu
Cc: ktkhai@parallels.com, rostedt@goodmis.org, juri.lelli@gmail.com,
	pang.xunlei@linaro.org, oleg@redhat.com,
	linux-kernel@vger.kernel.org,
	"Peter Zijlstra" <peterz@infradead.org>
Subject: [RFC][PATCH 4/7] sched,rt: Remove return value from pull_rt_task()
Date: Mon, 01 Jun 2015 15:58:22 +0200	[thread overview]
Message-ID: <20150601140839.948191068@infradead.org> (raw)
In-Reply-To: 20150601135818.506080835@infradead.org

[-- Attachment #1: peterz-sched-post_schedule-2.patch --]
[-- Type: text/plain, Size: 2409 bytes --]

In order to be able to use pull_rt_task() from a callback, we need to
do away with the return value.

Since the return value indicates if we should reschedule, do this
inside the function. Since not all callers currently do this, this can
increase the number of reschedules due rt balancing.

Too many reschedules is not a correctness issues, too few are.


Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/sched/rt.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -260,7 +260,7 @@ int alloc_rt_sched_group(struct task_gro
 
 #ifdef CONFIG_SMP
 
-static int pull_rt_task(struct rq *this_rq);
+static void pull_rt_task(struct rq *this_rq);
 
 static inline bool need_pull_rt_task(struct rq *rq, struct task_struct *prev)
 {
@@ -415,9 +415,8 @@ static inline bool need_pull_rt_task(str
 	return false;
 }
 
-static inline int pull_rt_task(struct rq *this_rq)
+static inline void pull_rt_task(struct rq *this_rq)
 {
-	return 0;
 }
 
 static inline void queue_push_tasks(struct rq *rq)
@@ -1955,14 +1954,15 @@ static void push_irq_work_func(struct ir
 }
 #endif /* HAVE_RT_PUSH_IPI */
 
-static int pull_rt_task(struct rq *this_rq)
+static void pull_rt_task(struct rq *this_rq)
 {
-	int this_cpu = this_rq->cpu, ret = 0, cpu;
+	int this_cpu = this_rq->cpu, cpu;
+	bool resched = false;
 	struct task_struct *p;
 	struct rq *src_rq;
 
 	if (likely(!rt_overloaded(this_rq)))
-		return 0;
+		return;
 
 	/*
 	 * Match the barrier from rt_set_overloaded; this guarantees that if we
@@ -1973,7 +1973,7 @@ static int pull_rt_task(struct rq *this_
 #ifdef HAVE_RT_PUSH_IPI
 	if (sched_feat(RT_PUSH_IPI)) {
 		tell_cpu_to_push(this_rq);
-		return 0;
+		return;
 	}
 #endif
 
@@ -2026,7 +2026,7 @@ static int pull_rt_task(struct rq *this_
 			if (p->prio < src_rq->curr->prio)
 				goto skip;
 
-			ret = 1;
+			resched = true;
 
 			deactivate_task(src_rq, p, 0);
 			set_task_cpu(p, this_cpu);
@@ -2042,7 +2042,8 @@ static int pull_rt_task(struct rq *this_
 		double_unlock_balance(this_rq, src_rq);
 	}
 
-	return ret;
+	if (resched)
+		resched_curr(this_rq);
 }
 
 /*
@@ -2138,8 +2139,7 @@ static void switched_from_rt(struct rq *
 	if (!task_on_rq_queued(p) || rq->rt.rt_nr_running)
 		return;
 
-	if (pull_rt_task(rq))
-		resched_curr(rq);
+	pull_rt_task(rq);
 }
 
 void __init init_sched_rt_class(void)



  parent reply	other threads:[~2015-06-01 14:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 13:58 [RFC][PATCH 0/7] sched: balance callbacks Peter Zijlstra
2015-06-01 13:58 ` [RFC][PATCH 1/7] sched: Replace post_schedule with a balance callback list Peter Zijlstra
2015-06-03  4:41   ` Kamalesh Babulal
2015-06-03  7:21     ` Peter Zijlstra
2015-06-03  8:24   ` pang.xunlei
2015-06-03  8:55     ` Peter Zijlstra
2015-06-05  7:13       ` pang.xunlei
2015-06-05  7:19         ` Peter Zijlstra
2015-06-01 13:58 ` [RFC][PATCH 2/7] sched: Use replace normalize_task() with __sched_setscheduler() Peter Zijlstra
2015-06-01 13:58 ` [RFC][PATCH 3/7] sched: Allow balance callbacks for check_class_changed() Peter Zijlstra
2015-06-02 13:58   ` Kirill Tkhai
2015-06-02 14:27     ` Peter Zijlstra
2015-06-02 16:07       ` Peter Zijlstra
2015-06-02 16:27         ` Kirill Tkhai
2015-06-03  7:32           ` Peter Zijlstra
2015-06-03 10:40             ` Kirill Tkhai
2015-06-03 10:42             ` Kirill Tkhai
2015-06-03 10:45               ` Peter Zijlstra
2015-06-01 13:58 ` Peter Zijlstra [this message]
2015-06-01 13:58 ` [RFC][PATCH 5/7] sched,rt: Convert switched_{from,to}_rt() / prio_changed_rt() to balance callbacks Peter Zijlstra
2015-06-01 13:58 ` [RFC][PATCH 6/7] sched,dl: Remove return value from pull_dl_task() Peter Zijlstra
2015-06-01 13:58 ` [RFC][PATCH 7/7] sched,dl: Convert switched_{from,to}_dl() / prio_changed_dl() to balance callbacks Peter Zijlstra
2015-06-03  4:52   ` Kamalesh Babulal
2015-06-01 14:16 ` [RFC][PATCH 0/7] sched: " Peter Zijlstra
2015-06-01 14:42 ` Mike Galbraith
2015-06-02  6:48   ` Mike Galbraith

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=20150601140839.948191068@infradead.org \
    --to=peterz@infradead.org \
    --cc=juri.lelli@gmail.com \
    --cc=ktkhai@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=pang.xunlei@linaro.org \
    --cc=rostedt@goodmis.org \
    --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 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).