Skip to contentSkip to conversation

Make scheduler root_domain modular (sched_class specific)

PATCH In review Ankita Garg 3 participants 6 messages Mar 22, 2008 – Mar 23, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make scheduler root_domain modular (sched_class specific)

Hello,

Thanks Gregory for clarifying my question on root_domains infrastructure. What I was effectively mentioning on irc the other day was to make the root_domain infrastructure modular, ie sched_class specific. Currently, only rt is making use of this infrasture. Making it modular would enable ease of extension to other sched_classes if required. Trivial patch to that effect.

Patch compile and boot tested.

kernel/sched.c +10 -5
Index: linux-2.6.24.3-rt3/kernel/sched.c
===================================================================
@@ -337,11 +337,8 @@
  * object.
  *
  */
-struct root_domain {
-	atomic_t refcount;
-	cpumask_t span;
-	cpumask_t online;
 
+struct rt_root_domain {
 	/*
 	 * The "RT overload" flag: it gets set if a CPU has more than
 	 * one runnable RT task.
@@ -353,6 +350,14 @@
 #endif
 };
 
+struct root_domain {
+	atomic_t refcount;
+	cpumask_t span;
+	cpumask_t online;
+
+	struct rt_root_domain rt_dom;
+};
+
 /*
  * By default the system creates a single root-domain with all cpus as
  * members (mimicking the global state we have today).
@@ -6332,7 +6337,7 @@
 	cpus_clear(rd->span);
 	cpus_clear(rd->online);
 
-	cpupri_init(&rd->cpupri);
+	cpupri_init(&rd->rt_dom.cpupri);
 
 }
 
kernel/sched_rt.c +11 -11
Index: linux-2.6.24.3-rt3/kernel/sched_rt.c
===================================================================
@@ -7,12 +7,12 @@
 
 static inline int rt_overloaded(struct rq *rq)
 {
-	return atomic_read(&rq->rd->rto_count);
+	return atomic_read(&rq->rd->rt_dom.rto_count);
 }
 
 static inline void rt_set_overload(struct rq *rq)
 {
-	cpu_set(rq->cpu, rq->rd->rto_mask);
+	cpu_set(rq->cpu, rq->rd->rt_dom.rto_mask);
 	/*
 	 * Make sure the mask is visible before we set
 	 * the overload count. That is checked to determine
@@ -21,14 +21,14 @@
 	 * updated yet.
 	 */
 	wmb();
-	atomic_inc(&rq->rd->rto_count);
+	atomic_inc(&rq->rd->rt_dom.rto_count);
 }
 
 static inline void rt_clear_overload(struct rq *rq)
 {
 	/* the order here really doesn't matter */
-	atomic_dec(&rq->rd->rto_count);
-	cpu_clear(rq->cpu, rq->rd->rto_mask);
+	atomic_dec(&rq->rd->rt_dom.rto_count);
+	cpu_clear(rq->cpu, rq->rd->rt_dom.rto_mask);
 }
 
 static void update_rt_migration(struct rq *rq)
@@ -78,7 +78,7 @@
 #ifdef CONFIG_SMP
 	if (p->prio < rq->rt.highest_prio) {
 		rq->rt.highest_prio = p->prio;
-		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+		cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, p->prio);
 	}
 	if (p->nr_cpus_allowed > 1)
 		rq->rt.rt_nr_migratory++;
@@ -114,7 +114,7 @@
 	}
 
 	if (rq->rt.highest_prio != highest_prio)
-		cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+		cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, rq->rt.highest_prio);
 
 	update_rt_migration(rq);
 #endif /* CONFIG_SMP */
@@ -363,7 +363,7 @@
 {
 	int count;
 
-	count = cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask);
+	count = cpupri_find(&task_rq(task)->rd->rt_dom.cpupri, task, lowest_mask);
 
 	/*
 	 * cpupri cannot efficiently tell us how many bits are set, so it only
@@ -599,7 +599,7 @@
 
 	next = pick_next_task_rt(this_rq);
 
-	for_each_cpu_mask(cpu, this_rq->rd->rto_mask) {
+	for_each_cpu_mask(cpu, this_rq->rd->rt_dom.rto_mask) {
 		if (this_cpu == cpu)
 			continue;
 
@@ -763,7 +763,7 @@
 	if (rq->rt.overloaded)
 		rt_set_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+	cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, rq->rt.highest_prio);
 }
 
 /* Assumes rq->lock is held */
@@ -772,7 +772,7 @@
 	if (rq->rt.overloaded)
 		rt_clear_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, CPUPRI_INVALID);
+	cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, CPUPRI_INVALID);
 }
 
 /*
Signature · 5 lines
Regards,
Ankita Garg ([email protected])
Linux Technology Center
IBM India Systems & Technology Labs, 
Bangalore, India   
Acked-by on v1 1/1
#1 lore raw

Re: [RT] [PATCH] Make scheduler root_domain modular (sched_classspecific)

Quoted 1 line
Quoted 1 line
Quoted 1 line

On Sat, Mar 22, 2008 at 10:29 AM, in message

Quoted 11 lines · Ankita Garg

Hello,

Thanks Gregory for clarifying my question on root_domains infrastructure. What
I was effectively mentioning on irc the other day was to make the root_domain
infrastructure modular, ie sched_class specific. Currently, only rt is making
use of this infrasture. Making it modular would enable ease of extension to other sched_classes if required. Trivial patch to that effect.

Quoted 1 line

Patch compile and boot tested.

Hi Ankita,
Very nice, thanks! Couple of minor nits and further cleanup opportunities inline, but otherwise:

Quoted 22 lines

Index: linux-2.6.24.3-rt3/kernel/sched.c
===================================================================

kernel/sched.c +1 -4
@@ -337,11 +337,8 @@
  * object.
  *
  */
-struct root_domain {
-	atomic_t refcount;
-	cpumask_t span;
-	cpumask_t online;
 
+struct rt_root_domain {
 	/*
 	 * The "RT overload" flag: it gets set if a CPU has more than
 	 * one runnable RT task.

kernel/sched.c line 358

Quoted 9 lines
kernel/sched.c +6 -0
@@ -353,6 +350,14 @@
 #endif
 };
 
+struct root_domain {
+	atomic_t refcount;
+	cpumask_t span;
+	cpumask_t online;
+
+	struct rt_root_domain rt_dom;

Perhaps this should just be s/rt_dom/rt since it is already implicitly a domain just by being a subordinate member of a domain structure.

Quoted 19 lines
kernel/sched.c +3 -1
+};
+
 /*
  * By default the system creates a single root-domain with all cpus as
  * members (mimicking the global state we have today).
@@ -6332,7 +6337,7 @@
 	cpus_clear(rd->span);
 	cpus_clear(rd->online);
 
-	cpupri_init(&rd->cpupri);
+	cpupri_init(&rd->rt_dom.cpupri);
 
 }
 

Index: linux-2.6.24.3-rt3/kernel/sched_rt.c
===================================================================

kernel/sched_rt.c line 10

Quoted 5 lines
kernel/sched_rt.c +1 -1
@@ -7,12 +7,12 @@
 
 static inline int rt_overloaded(struct rq *rq)
 {
-	return atomic_read(&rq->rd->rto_count);
+	return atomic_read(&rq->rd->rt_dom.rto_count);

Perhaps we should change s/rto_count/overload_count and s/rto_mask/overload_mask, since "rt" is now implicit with the association with rt_root_domain?

Quoted 81 lines
kernel/sched_rt.c +10 -10
 }
 
 static inline void rt_set_overload(struct rq *rq)
 {
-	cpu_set(rq->cpu, rq->rd->rto_mask);
+	cpu_set(rq->cpu, rq->rd->rt_dom.rto_mask);
 	/*
 	 * Make sure the mask is visible before we set
 	 * the overload count. That is checked to determine
@@ -21,14 +21,14 @@
 	 * updated yet.
 	 */
 	wmb();
-	atomic_inc(&rq->rd->rto_count);
+	atomic_inc(&rq->rd->rt_dom.rto_count);
 }
 
 static inline void rt_clear_overload(struct rq *rq)
 {
 	/* the order here really doesn't matter */
-	atomic_dec(&rq->rd->rto_count);
-	cpu_clear(rq->cpu, rq->rd->rto_mask);
+	atomic_dec(&rq->rd->rt_dom.rto_count);
+	cpu_clear(rq->cpu, rq->rd->rt_dom.rto_mask);
 }
 
 static void update_rt_migration(struct rq *rq)
@@ -78,7 +78,7 @@
 #ifdef CONFIG_SMP
 	if (p->prio < rq->rt.highest_prio) {
 		rq->rt.highest_prio = p->prio;
-		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+		cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, p->prio);
 	}
 	if (p->nr_cpus_allowed > 1)
 		rq->rt.rt_nr_migratory++;
@@ -114,7 +114,7 @@
 	}
 
 	if (rq->rt.highest_prio != highest_prio)
-		cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+		cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, rq->rt.highest_prio);
 
 	update_rt_migration(rq);
 #endif /* CONFIG_SMP */
@@ -363,7 +363,7 @@
 {
 	int count;
 
-	count = cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask);
+	count = cpupri_find(&task_rq(task)->rd->rt_dom.cpupri, task, lowest_mask);
 
 	/*
 	 * cpupri cannot efficiently tell us how many bits are set, so it only
@@ -599,7 +599,7 @@
 
 	next = pick_next_task_rt(this_rq);
 
-	for_each_cpu_mask(cpu, this_rq->rd->rto_mask) {
+	for_each_cpu_mask(cpu, this_rq->rd->rt_dom.rto_mask) {
 		if (this_cpu == cpu)
 			continue;
 
@@ -763,7 +763,7 @@
 	if (rq->rt.overloaded)
 		rt_set_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+	cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, rq->rt.highest_prio);
 }
 
 /* Assumes rq->lock is held */
@@ -772,7 +772,7 @@
 	if (rq->rt.overloaded)
 		rt_clear_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, CPUPRI_INVALID);
+	cpupri_set(&rq->rd->rt_dom.cpupri, rq->cpu, CPUPRI_INVALID);
 }
 
 /*
#2 lore raw

Re: [RT] [PATCH] Make scheduler root_domain modular (sched_classspecific)

Hi Gregory,

Quoted 13 lines · Gregory Haskins
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Sat, Mar 22, 2008 at 10:29 AM, in message

Quoted 11 lines · Ankita Garg

Hello,

Thanks Gregory for clarifying my question on root_domains infrastructure. What
I was effectively mentioning on irc the other day was to make the root_domain
infrastructure modular, ie sched_class specific. Currently, only rt is making
use of this infrasture. Making it modular would enable ease of extension to other sched_classes if required. Trivial patch to that effect.

Quoted 8 lines
Quoted 1 line

Patch compile and boot tested.

Hi Ankita,
Very nice, thanks! Couple of minor nits and further cleanup opportunities inline, but otherwise:

Quoted 1 line

The changes you have suggested are consistent with what we do for rt_rq and cfs_rq. Here is the patch with these modifications.

kernel/sched.c +12 -7
Index: linux-2.6.24.3-rt3/kernel/sched.c
===================================================================
@@ -337,22 +337,27 @@
  * object.
  *
  */
-struct root_domain {
-	atomic_t refcount;
-	cpumask_t span;
-	cpumask_t online;
 
+struct rt_root_domain {
 	/*
 	 * The "RT overload" flag: it gets set if a CPU has more than
 	 * one runnable RT task.
 	 */
-	cpumask_t rto_mask;
-	atomic_t rto_count;
+	cpumask_t overload_mask;
+	atomic_t overload_count;
 #ifdef CONFIG_SMP
 	struct cpupri cpupri;
 #endif
 };
 
+struct root_domain {
+	atomic_t refcount;
+	cpumask_t span;
+	cpumask_t online;
+
+	struct rt_root_domain rt;
+};
+
 /*
  * By default the system creates a single root-domain with all cpus as
  * members (mimicking the global state we have today).
@@ -6332,7 +6337,7 @@
 	cpus_clear(rd->span);
 	cpus_clear(rd->online);
 
-	cpupri_init(&rd->cpupri);
+	cpupri_init(&rd->rt.cpupri);
 
 }
 
kernel/sched_rt.c +11 -11
Index: linux-2.6.24.3-rt3/kernel/sched_rt.c
===================================================================
@@ -7,12 +7,12 @@
 
 static inline int rt_overloaded(struct rq *rq)
 {
-	return atomic_read(&rq->rd->rto_count);
+	return atomic_read(&rq->rd->rt.overload_count);
 }
 
 static inline void rt_set_overload(struct rq *rq)
 {
-	cpu_set(rq->cpu, rq->rd->rto_mask);
+	cpu_set(rq->cpu, rq->rd->rt.overload_mask);
 	/*
 	 * Make sure the mask is visible before we set
 	 * the overload count. That is checked to determine
@@ -21,14 +21,14 @@
 	 * updated yet.
 	 */
 	wmb();
-	atomic_inc(&rq->rd->rto_count);
+	atomic_inc(&rq->rd->rt.overload_count);
 }
 
 static inline void rt_clear_overload(struct rq *rq)
 {
 	/* the order here really doesn't matter */
-	atomic_dec(&rq->rd->rto_count);
-	cpu_clear(rq->cpu, rq->rd->rto_mask);
+	atomic_dec(&rq->rd->rt.overload_count);
+	cpu_clear(rq->cpu, rq->rd->rt.overload_mask);
 }
 
 static void update_rt_migration(struct rq *rq)
@@ -78,7 +78,7 @@
 #ifdef CONFIG_SMP
 	if (p->prio < rq->rt.highest_prio) {
 		rq->rt.highest_prio = p->prio;
-		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+		cpupri_set(&rq->rd->rt.cpupri, rq->cpu, p->prio);
 	}
 	if (p->nr_cpus_allowed > 1)
 		rq->rt.rt_nr_migratory++;
@@ -114,7 +114,7 @@
 	}
 
 	if (rq->rt.highest_prio != highest_prio)
-		cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+		cpupri_set(&rq->rd->rt.cpupri, rq->cpu, rq->rt.highest_prio);
 
 	update_rt_migration(rq);
 #endif /* CONFIG_SMP */
@@ -363,7 +363,7 @@
 {
 	int count;
 
-	count = cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask);
+	count = cpupri_find(&task_rq(task)->rd->rt.cpupri, task, lowest_mask);
 
 	/*
 	 * cpupri cannot efficiently tell us how many bits are set, so it only
@@ -599,7 +599,7 @@
 
 	next = pick_next_task_rt(this_rq);
 
-	for_each_cpu_mask(cpu, this_rq->rd->rto_mask) {
+	for_each_cpu_mask(cpu, this_rq->rd->rt.overload_mask) {
 		if (this_cpu == cpu)
 			continue;
 
@@ -763,7 +763,7 @@
 	if (rq->rt.overloaded)
 		rt_set_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+	cpupri_set(&rq->rd->rt.cpupri, rq->cpu, rq->rt.highest_prio);
 }
 
 /* Assumes rq->lock is held */
@@ -772,7 +772,7 @@
 	if (rq->rt.overloaded)
 		rt_clear_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, CPUPRI_INVALID);
+	cpupri_set(&rq->rd->rt.cpupri, rq->cpu, CPUPRI_INVALID);
 }
 
 /*
Signature · 5 lines
Regards,
Ankita Garg ([email protected])
Linux Technology Center
IBM India Systems & Technology Labs, 
Bangalore, India   
#3 lore raw

Re: [RT] [PATCH] Make scheduler root_domain modular (sched_classspecific)

Quoted 18 lines · Ankita Garg

Hi Gregory,

Quoted 15 lines · Gregory Haskins
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Sat, Mar 22, 2008 at 10:29 AM, in message

Quoted 12 lines · Ankita Garg

Hello,

Thanks Gregory for clarifying my question on root_domains infrastructure. What
I was effectively mentioning on irc the other day was to make the root_domain
infrastructure modular, ie sched_class specific. Currently, only rt is making
use of this infrasture. Making it modular would enable ease of extension to other sched_classes if required. Trivial patch to that effect.

Patch compile and boot tested.

Quoted 8 lines
Quoted 6 lines

Hi Ankita,
Very nice, thanks! Couple of minor nits and further cleanup opportunities inline, but otherwise:

Quoted 1 line

The changes you have suggested are consistent with what we do for rt_rq and cfs_rq. Here is the patch with these modifications.

As this patch doesn't touch -rt specific code you should have provided a patch against the upstream code in sched-devel/latest.

patching file kernel/sched.c
Hunk #1 FAILED at 337.
Hunk #2 FAILED at 6337.
2 out of 2 hunks FAILED -- rejects in file kernel/sched.c patching file kernel/sched_rt.c
Hunk #3 FAILED at 78.
Hunk #4 FAILED at 114.
Hunk #5 FAILED at 363.
Hunk #6 succeeded at 1005 (offset 406 lines).
Hunk #7 FAILED at 1169.
Hunk #8 FAILED at 1178.
5 out of 8 hunks FAILED -- rejects in file kernel/sched_rt.c

Quoted 141 lines

Index: linux-2.6.24.3-rt3/kernel/sched.c
===================================================================

kernel/sched.c +12 -7
@@ -337,22 +337,27 @@
  * object.
  *
  */
-struct root_domain {
-	atomic_t refcount;
-	cpumask_t span;
-	cpumask_t online;
 
+struct rt_root_domain {
 	/*
 	 * The "RT overload" flag: it gets set if a CPU has more than
 	 * one runnable RT task.
 	 */
-	cpumask_t rto_mask;
-	atomic_t rto_count;
+	cpumask_t overload_mask;
+	atomic_t overload_count;
 #ifdef CONFIG_SMP
 	struct cpupri cpupri;
 #endif
 };
 
+struct root_domain {
+	atomic_t refcount;
+	cpumask_t span;
+	cpumask_t online;
+
+	struct rt_root_domain rt;
+};
+
 /*
  * By default the system creates a single root-domain with all cpus as
  * members (mimicking the global state we have today).
@@ -6332,7 +6337,7 @@
 	cpus_clear(rd->span);
 	cpus_clear(rd->online);
 
-	cpupri_init(&rd->cpupri);
+	cpupri_init(&rd->rt.cpupri);
 
 }
 

Index: linux-2.6.24.3-rt3/kernel/sched_rt.c
===================================================================

kernel/sched_rt.c +11 -11
@@ -7,12 +7,12 @@
 
 static inline int rt_overloaded(struct rq *rq)
 {
-	return atomic_read(&rq->rd->rto_count);
+	return atomic_read(&rq->rd->rt.overload_count);
 }
 
 static inline void rt_set_overload(struct rq *rq)
 {
-	cpu_set(rq->cpu, rq->rd->rto_mask);
+	cpu_set(rq->cpu, rq->rd->rt.overload_mask);
 	/*
 	 * Make sure the mask is visible before we set
 	 * the overload count. That is checked to determine
@@ -21,14 +21,14 @@
 	 * updated yet.
 	 */
 	wmb();
-	atomic_inc(&rq->rd->rto_count);
+	atomic_inc(&rq->rd->rt.overload_count);
 }
 
 static inline void rt_clear_overload(struct rq *rq)
 {
 	/* the order here really doesn't matter */
-	atomic_dec(&rq->rd->rto_count);
-	cpu_clear(rq->cpu, rq->rd->rto_mask);
+	atomic_dec(&rq->rd->rt.overload_count);
+	cpu_clear(rq->cpu, rq->rd->rt.overload_mask);
 }
 
 static void update_rt_migration(struct rq *rq)
@@ -78,7 +78,7 @@
 #ifdef CONFIG_SMP
 	if (p->prio < rq->rt.highest_prio) {
 		rq->rt.highest_prio = p->prio;
-		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+		cpupri_set(&rq->rd->rt.cpupri, rq->cpu, p->prio);
 	}
 	if (p->nr_cpus_allowed > 1)
 		rq->rt.rt_nr_migratory++;
@@ -114,7 +114,7 @@
 	}
 
 	if (rq->rt.highest_prio != highest_prio)
-		cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+		cpupri_set(&rq->rd->rt.cpupri, rq->cpu, rq->rt.highest_prio);
 
 	update_rt_migration(rq);
 #endif /* CONFIG_SMP */
@@ -363,7 +363,7 @@
 {
 	int count;
 
-	count = cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask);
+	count = cpupri_find(&task_rq(task)->rd->rt.cpupri, task, lowest_mask);
 
 	/*
 	 * cpupri cannot efficiently tell us how many bits are set, so it only
@@ -599,7 +599,7 @@
 
 	next = pick_next_task_rt(this_rq);
 
-	for_each_cpu_mask(cpu, this_rq->rd->rto_mask) {
+	for_each_cpu_mask(cpu, this_rq->rd->rt.overload_mask) {
 		if (this_cpu == cpu)
 			continue;
 
@@ -763,7 +763,7 @@
 	if (rq->rt.overloaded)
 		rt_set_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+	cpupri_set(&rq->rd->rt.cpupri, rq->cpu, rq->rt.highest_prio);
 }
 
 /* Assumes rq->lock is held */
@@ -772,7 +772,7 @@
 	if (rq->rt.overloaded)
 		rt_clear_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, CPUPRI_INVALID);
+	cpupri_set(&rq->rd->rt.cpupri, rq->cpu, CPUPRI_INVALID);
 }
 
 /*
#4 lore raw

Re: [RT] [PATCH] Make scheduler root_domain modular (sched_classspecific)

Hi Peter,

Quoted 22 lines · Peter Zijlstra
Quoted 21 lines · Ankita Garg

Hi Gregory,

Quoted 18 lines · Gregory Haskins
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Sat, Mar 22, 2008 at 10:29 AM, in message

Quoted 11 lines · Ankita Garg

Hello,

Thanks Gregory for clarifying my question on root_domains infrastructure. What
I was effectively mentioning on irc the other day was to make the root_domain
infrastructure modular, ie sched_class specific. Currently, only rt is making
use of this infrasture. Making it modular would enable ease of extension to other sched_classes if required. Trivial patch to that effect.

Quoted 1 line

Patch compile and boot tested.

Hi Ankita,
Very nice, thanks! Couple of minor nits and further cleanup opportunities inline, but otherwise:

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

The changes you have suggested are consistent with what we do for rt_rq and cfs_rq. Here is the patch with these modifications.

As this patch doesn't touch -rt specific code you should have provided a patch against the upstream code in sched-devel/latest.

The cpupri bits have not been added to the sched-devel tree yet. This patch involves linking to the cpupri from the rt_root_domain. Thus the patch against the latest RT tree. Pl let me know if I understand it incorrectly.

Quoted 155 lines

patching file kernel/sched.c
Hunk #1 FAILED at 337.
Hunk #2 FAILED at 6337.
2 out of 2 hunks FAILED -- rejects in file kernel/sched.c patching file kernel/sched_rt.c
Hunk #3 FAILED at 78.
Hunk #4 FAILED at 114.
Hunk #5 FAILED at 363.
Hunk #6 succeeded at 1005 (offset 406 lines).
Hunk #7 FAILED at 1169.
Hunk #8 FAILED at 1178.
5 out of 8 hunks FAILED -- rejects in file kernel/sched_rt.c

Quoted 141 lines

Index: linux-2.6.24.3-rt3/kernel/sched.c
===================================================================

kernel/sched.c +12 -7
@@ -337,22 +337,27 @@
  * object.
  *
  */
-struct root_domain {
-	atomic_t refcount;
-	cpumask_t span;
-	cpumask_t online;
 
+struct rt_root_domain {
 	/*
 	 * The "RT overload" flag: it gets set if a CPU has more than
 	 * one runnable RT task.
 	 */
-	cpumask_t rto_mask;
-	atomic_t rto_count;
+	cpumask_t overload_mask;
+	atomic_t overload_count;
 #ifdef CONFIG_SMP
 	struct cpupri cpupri;
 #endif
 };
 
+struct root_domain {
+	atomic_t refcount;
+	cpumask_t span;
+	cpumask_t online;
+
+	struct rt_root_domain rt;
+};
+
 /*
  * By default the system creates a single root-domain with all cpus as
  * members (mimicking the global state we have today).
@@ -6332,7 +6337,7 @@
 	cpus_clear(rd->span);
 	cpus_clear(rd->online);
 
-	cpupri_init(&rd->cpupri);
+	cpupri_init(&rd->rt.cpupri);
 
 }
 

Index: linux-2.6.24.3-rt3/kernel/sched_rt.c
===================================================================

kernel/sched_rt.c +11 -11
@@ -7,12 +7,12 @@
 
 static inline int rt_overloaded(struct rq *rq)
 {
-	return atomic_read(&rq->rd->rto_count);
+	return atomic_read(&rq->rd->rt.overload_count);
 }
 
 static inline void rt_set_overload(struct rq *rq)
 {
-	cpu_set(rq->cpu, rq->rd->rto_mask);
+	cpu_set(rq->cpu, rq->rd->rt.overload_mask);
 	/*
 	 * Make sure the mask is visible before we set
 	 * the overload count. That is checked to determine
@@ -21,14 +21,14 @@
 	 * updated yet.
 	 */
 	wmb();
-	atomic_inc(&rq->rd->rto_count);
+	atomic_inc(&rq->rd->rt.overload_count);
 }
 
 static inline void rt_clear_overload(struct rq *rq)
 {
 	/* the order here really doesn't matter */
-	atomic_dec(&rq->rd->rto_count);
-	cpu_clear(rq->cpu, rq->rd->rto_mask);
+	atomic_dec(&rq->rd->rt.overload_count);
+	cpu_clear(rq->cpu, rq->rd->rt.overload_mask);
 }
 
 static void update_rt_migration(struct rq *rq)
@@ -78,7 +78,7 @@
 #ifdef CONFIG_SMP
 	if (p->prio < rq->rt.highest_prio) {
 		rq->rt.highest_prio = p->prio;
-		cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
+		cpupri_set(&rq->rd->rt.cpupri, rq->cpu, p->prio);
 	}
 	if (p->nr_cpus_allowed > 1)
 		rq->rt.rt_nr_migratory++;
@@ -114,7 +114,7 @@
 	}
 
 	if (rq->rt.highest_prio != highest_prio)
-		cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+		cpupri_set(&rq->rd->rt.cpupri, rq->cpu, rq->rt.highest_prio);
 
 	update_rt_migration(rq);
 #endif /* CONFIG_SMP */
@@ -363,7 +363,7 @@
 {
 	int count;
 
-	count = cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask);
+	count = cpupri_find(&task_rq(task)->rd->rt.cpupri, task, lowest_mask);
 
 	/*
 	 * cpupri cannot efficiently tell us how many bits are set, so it only
@@ -599,7 +599,7 @@
 
 	next = pick_next_task_rt(this_rq);
 
-	for_each_cpu_mask(cpu, this_rq->rd->rto_mask) {
+	for_each_cpu_mask(cpu, this_rq->rd->rt.overload_mask) {
 		if (this_cpu == cpu)
 			continue;
 
@@ -763,7 +763,7 @@
 	if (rq->rt.overloaded)
 		rt_set_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, rq->rt.highest_prio);
+	cpupri_set(&rq->rd->rt.cpupri, rq->cpu, rq->rt.highest_prio);
 }
 
 /* Assumes rq->lock is held */
@@ -772,7 +772,7 @@
 	if (rq->rt.overloaded)
 		rt_clear_overload(rq);
 
-	cpupri_set(&rq->rd->cpupri, rq->cpu, CPUPRI_INVALID);
+	cpupri_set(&rq->rd->rt.cpupri, rq->cpu, CPUPRI_INVALID);
 }
 
 /*
Signature · 5 lines
Regards,
Ankita Garg ([email protected])
Linux Technology Center
IBM India Systems & Technology Labs, 
Bangalore, India   
#5 lore raw

Re: [RT] [PATCH] Make scheduler root_domain modular (sched_classspecific)

Quoted 31 lines · Ankita Garg

Hi Peter,

Quoted 28 lines · Peter Zijlstra
Quoted 26 lines · Ankita Garg

Hi Gregory,

Quoted 13 lines · Gregory Haskins
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Sat, Mar 22, 2008 at 10:29 AM, in message

Quoted 11 lines · Ankita Garg

Hello,

Thanks Gregory for clarifying my question on root_domains infrastructure. What
I was effectively mentioning on irc the other day was to make the root_domain
infrastructure modular, ie sched_class specific. Currently, only rt is making
use of this infrasture. Making it modular would enable ease of extension to other sched_classes if required. Trivial patch to that effect.

Quoted 8 lines
Quoted 1 line

Patch compile and boot tested.

Hi Ankita,
Very nice, thanks! Couple of minor nits and further cleanup opportunities inline, but otherwise:

Quoted 1 line

The changes you have suggested are consistent with what we do for rt_rq and cfs_rq. Here is the patch with these modifications.

Quoted 8 lines
Quoted 3 lines

As this patch doesn't touch -rt specific code you should have provided a patch against the upstream code in sched-devel/latest.

The cpupri bits have not been added to the sched-devel tree yet. This patch involves linking to the cpupri from the rt_root_domain. Thus the patch against the latest RT tree. Pl let me know if I understand it incorrectly.

The root_domain code is upstream and not -rt specific, that -rt carries a patch that touches this code is perhaps unfortunate.

We strive to keep the -rt patch as small as possible, that means push stuff upstream whenever possible. As your patch doesn't change anything specific to -rt, upstream is the right place to restructure the root_domain code. Next time the -rt tree gets fwd ported the cpupri bits will be made to match.