Skip to contentSkip to conversation

sched: Clean unused fields from struct rq

PATCH Superseded Luis Henriques 2 participants 5 messages Mar 18, 2009

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Clean unused fields from struct rq

Since they are used on in statistics and are always set to zero, the following fields from struct rq have been removed: yld_exp_empty, yld_act_empty and yld_both_empty.

Sched Debug version has also been incremented.

---
 kernel/sched.c       |    3 ---
 kernel/sched_debug.c |    5 +----
 kernel/sched_stats.h |    5 ++---
 3 files changed, 3 insertions(+), 10 deletions(-)
kernel/sched.c +0 -3
index 4000304..289eac2 100644
@@ -646,9 +646,6 @@ struct rq {
 	/* could above be rq->cfs_rq.exec_clock + rq->rt_rq.rt_runtime ? */
 
 	/* sys_sched_yield() stats */
-	unsigned int yld_exp_empty;
-	unsigned int yld_act_empty;
-	unsigned int yld_both_empty;
 	unsigned int yld_count;
 
 	/* schedule() stats */
kernel/sched_debug.c +1 -4
index 2b1260f..58cdc5c 100644
@@ -287,9 +287,6 @@ static void print_cpu(struct seq_file *m, int cpu)
 #ifdef CONFIG_SCHEDSTATS
 #define P(n) SEQ_printf(m, "  .%-30s: %d\n", #n, rq->n);
 
-	P(yld_exp_empty);
-	P(yld_act_empty);
-	P(yld_both_empty);
 	P(yld_count);
 
 	P(sched_switch);
@@ -314,7 +311,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
 	u64 now = ktime_to_ns(ktime_get());
 	int cpu;
 
-	SEQ_printf(m, "Sched Debug Version: v0.08, %s %.*s\n",
+	SEQ_printf(m, "Sched Debug Version: v0.09, %s %.*s\n",
 		init_utsname()->release,
 		(int)strcspn(init_utsname()->version, " "),
 		init_utsname()->version);
kernel/sched_stats.h +2 -3
index a8f93dd..2e7287a 100644
@@ -26,9 +26,8 @@ static int show_schedstat(struct seq_file *seq, void *v)
 
 		/* runqueue-specific stats */
 		seq_printf(seq,
-		    "cpu%d %u %u %u %u %u %u %u %u %u %llu %llu %lu",
-		    cpu, rq->yld_both_empty,
-		    rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count,
+		    "cpu%d %u %u %u %u %u %u %llu %llu %lu",
+		    cpu, rq->yld_count,
 		    rq->sched_switch, rq->sched_count, rq->sched_goidle,
 		    rq->ttwu_count, rq->ttwu_local,
 		    rq->rq_cpu_time,
Signature · 5 lines
1.6.2


-- 
Luis Henriques
#1 lore raw

Hi Luis,

Quoted 42 lines · Luis Henriques

Since they are used on in statistics and are always set to zero, the following fields from struct rq have been removed: yld_exp_empty, yld_act_empty and yld_both_empty.

Sched Debug version has also been incremented.

---
 kernel/sched.c       |    3 ---
 kernel/sched_debug.c |    5 +----
 kernel/sched_stats.h |    5 ++---
 3 files changed, 3 insertions(+), 10 deletions(-)
kernel/sched.c +0 -3
index 4000304..289eac2 100644
@@ -646,9 +646,6 @@ struct rq {
 	/* could above be rq->cfs_rq.exec_clock + rq->rt_rq.rt_runtime ? */
 
 	/* sys_sched_yield() stats */
-	unsigned int yld_exp_empty;
-	unsigned int yld_act_empty;
-	unsigned int yld_both_empty;
 	unsigned int yld_count;
 
 	/* schedule() stats */
kernel/sched_debug.c +0 -3
index 2b1260f..58cdc5c 100644
@@ -287,9 +287,6 @@ static void print_cpu(struct seq_file *m, int cpu)
 #ifdef CONFIG_SCHEDSTATS
 #define P(n) SEQ_printf(m, "  .%-30s: %d\n", #n, rq->n);
 
-	P(yld_exp_empty);
-	P(yld_act_empty);
-	P(yld_both_empty);
 	P(yld_count);
 
 	P(sched_switch);

kernel/sched_debug.c static int sched_debug_show(struct seq_file *m, void *v) · line 315

Quoted 6 lines
kernel/sched_debug.c +1 -1
@@ -314,7 +311,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
 	u64 now = ktime_to_ns(ktime_get());
 	int cpu;
 
-	SEQ_printf(m, "Sched Debug Version: v0.08, %s %.*s\n",
+	SEQ_printf(m, "Sched Debug Version: v0.09, %s %.*s\n",
 

I actually key off the SCHEDSTAT_VERSION (currently 14) at the top of kernel/sched_stats.h. Cursory inspection of the existing code and your patch says that this should actually be the value that needs updating (vs. vSched-Debug). However, note that I am not sure if there are also users of sched-debug that need to see that version bump as well in order to remain compatible.

If you are really motivated, you can test your patches against my schedtop tool to verify sane behavior (for bumping SCHEDSTAT_VERSION to 15, I would expect it to gracefully report that it cannot handle this version and exit). You can find both source and rpms here:

http://rt.wiki.kernel.org/index.php/Schedtop_utility

Thanks!
-Greg

#2 lore raw

Hi Greg,

Quoted 6 lines · Gregory Haskins

I actually key off the SCHEDSTAT_VERSION (currently 14) at the top of kernel/sched_stats.h. Cursory inspection of the existing code and your patch says that this should actually be the value that needs updating (vs. vSched-Debug). However, note that I am not sure if there are also users of sched-debug that need to see that version bump as well in order to remain compatible.

Hmm... so, what's the relation between SCHEDSTAT_VERSION and the "Sched Debug" version I update in my patch? Assuming there is a relation... :-)

I believe that I actually need to update both versioning mechanims but I think this is something odd -- either there is one mechanism to handle version or a comment should clarify why there are two.

Quoted 4 lines

If you are really motivated, you can test your patches against my schedtop tool to verify sane behavior (for bumping SCHEDSTAT_VERSION to 15, I would expect it to gracefully report that it cannot handle this version and exit). You can find both source and rpms here:

Sure I will give it a try -- I'll let you know about the result.

Thanks!

Signature · 1 line
Luis Henriques
#3 lore raw
In reply to Gregory Haskins

Hi,

Quoted 6 lines · Gregory Haskins

I actually key off the SCHEDSTAT_VERSION (currently 14) at the top of kernel/sched_stats.h. Cursory inspection of the existing code and your patch says that this should actually be the value that needs updating (vs. vSched-Debug). However, note that I am not sure if there are also users of sched-debug that need to see that version bump as well in order to remain compatible.

Just realised something while taking a look at you're schedtop: you are referring to sched_stats, which shows data in /proc/schedstat, while my patch actually targets sched_debug, which shows data in /proc/sched_debug. And I guess this is why we have 2 different versioning mechanisms: they refer to different things :-)

So, if this is correct, my last patch actually updates the correct version, right?

Regards,

Signature · 1 line
Luis Henriques
#4 lore raw
Quoted 9 lines · Luis Henriques

Hi,

Quoted 6 lines · Gregory Haskins

I actually key off the SCHEDSTAT_VERSION (currently 14) at the top of kernel/sched_stats.h. Cursory inspection of the existing code and your patch says that this should actually be the value that needs updating (vs. vSched-Debug). However, note that I am not sure if there are also users of sched-debug that need to see that version bump as well in order to remain compatible.

Quoted 8 lines

Just realised something while taking a look at you're schedtop: you are referring to sched_stats, which shows data in /proc/schedstat, while my patch actually targets sched_debug, which shows data in /proc/sched_debug. And I guess this is why we have 2 different versioning mechanisms: they refer to different things :-)

So, if this is correct, my last patch actually updates the correct version, right?

Gah! Wrong again!

My patch touches both sched_debug and sched_stats, so I believe I need to change both versions.

Signature · 1 line
Luis Henriques