[PATCH 2/7] RT: Wrap the RQ notion of priority to make it conditional

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Steven Rostedt <rostedt@...>, Peter Zijlstra <a.p.zijlstra@...>
Cc: RT <linux-rt-users@...>, Ingo Molnar <mingo@...>, LKML <linux-kernel@...>, Gregory Haskins <ghaskins@...>
Date: Friday, October 12, 2007 - 8:15 pm

A little cleanup to avoid #ifdef proliferation later in the series

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---

 kernel/sched.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 0a1ad0e..c9afc8a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -255,6 +255,10 @@ struct cfs_rq {
 #endif
 };
 
+#if defined(CONFIG_PREEMPT_RT) && defined(CONFIG_SMP)
+#define  ENABLE_RQ_PRIORITY   /* Steve wants this conditional on PREEMPT_RT */
+#endif /* CONFIG_PREEMPT_RT */
+
 /* Real-Time classes' related field in a runqueue: */
 struct rt_rq {
 	struct rt_prio_array active;
@@ -304,6 +308,9 @@ struct rq {
 #ifdef CONFIG_PREEMPT_RT
 	unsigned long rt_nr_running;
 	unsigned long rt_nr_uninterruptible;
+#endif
+
+#ifdef ENABLE_RQ_PRIORITY
 	int curr_prio;
 #endif
 
@@ -365,6 +372,16 @@ struct rq {
 static DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
 static DEFINE_MUTEX(sched_hotcpu_mutex);
 
+#ifdef ENABLE_RQ_PRIORITY
+static inline void set_rq_prio(struct rq *rq, int prio)
+{
+	rq->curr_prio = prio;
+}
+
+#else
+#define set_rq_prio(rq, prio) do { } while(0)
+#endif
+
 static inline void check_preempt_curr(struct rq *rq, struct task_struct *p)
 {
 	rq->curr->sched_class->check_preempt_curr(rq, p);
@@ -2331,9 +2348,9 @@ static inline void finish_task_switch(struct rq *rq, struct task_struct *prev)
 	 */
 	prev_state = prev->state;
 	_finish_arch_switch(prev);
-#if defined(CONFIG_PREEMPT_RT) && defined(CONFIG_SMP)
-	rq->curr_prio = current->prio;
-#endif
+
+	set_rq_prio(rq, current->prio);
+
 	finish_lock_switch(rq, prev);
 #if defined(CONFIG_PREEMPT_RT) && defined(CONFIG_SMP)
 	/*

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/7] RT: RT-Overload/Sched enhancements (v2), Gregory Haskins, (Fri Oct 12, 8:15 pm)
[PATCH 6/7] RT: Select tasks based on relative affinity, Gregory Haskins, (Fri Oct 12, 8:16 pm)
Re: [PATCH 6/7] RT: Select tasks based on relative affinity, Gregory Haskins, (Mon Oct 15, 4:08 pm)
[PATCH 3/7] RT: Initialize the priority value, Gregory Haskins, (Fri Oct 12, 8:15 pm)
Re: [PATCH 3/7] RT: Initialize the priority value, Steven Rostedt, (Mon Oct 15, 1:46 pm)
[PATCH 2/7] RT: Wrap the RQ notion of priority to make it co..., Gregory Haskins, (Fri Oct 12, 8:15 pm)
[PATCH 1/7] RT: Add a per-cpu rt_overload indication, Gregory Haskins, (Fri Oct 12, 8:15 pm)
Re: [PATCH 1/7] RT: Add a per-cpu rt_overload indication, Steven Rostedt, (Mon Oct 15, 1:42 pm)