Skip to contentSkip to conversation

sched: only print migration_cost once

PATCH In review Chuck Ebbert 2 participants 2 messages Feb 3, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: only print migration_cost once

migration_cost prints after every CPU hotplug event. Make it print only once at boot.

kernel/sched.c +10 -6
@@ -5656,6 +5656,7 @@ static void calibrate_migration_costs(co
 	int cpu1 = -1, cpu2 = -1, cpu, orig_cpu = raw_smp_processor_id();
 	unsigned long j0, j1, distance, max_distance = 0;
 	struct sched_domain *sd;
+	static int printed_cost = 0; /* has cost already been printed? */
 
 	j0 = jiffies;
 
@@ -5699,13 +5700,16 @@ static void calibrate_migration_costs(co
 			-1
 #endif
 		);
-	printk("migration_cost=");
-	for (distance = 0; distance <= max_distance; distance++) {
-		if (distance)
-			printk(",");
-		printk("%ld", (long)migration_cost[distance] / 1000);
+	if (!printed_cost) {
+		printed_cost++;
+		printk("migration_cost=");
+		for (distance = 0; distance <= max_distance; distance++) {
+			if (distance)
+				printk(",");
+			printk("%ld", (long)migration_cost[distance] / 1000);
+		}
+		printk("\n");
 	}
-	printk("\n");
 	j1 = jiffies;
 	if (migration_debug)
 		printk("migration: %ld seconds\n", (j1-j0)/HZ);
Signature · 1 line
Chuck
#1 lore raw

hm, why not use system_state for this?

Ingo

Quoted 45 lines · Chuck Ebbert

migration_cost prints after every CPU hotplug event. Make it print only once at boot.

kernel/sched.c +10 -6
@@ -5656,6 +5656,7 @@ static void calibrate_migration_costs(co
 	int cpu1 = -1, cpu2 = -1, cpu, orig_cpu = raw_smp_processor_id();
 	unsigned long j0, j1, distance, max_distance = 0;
 	struct sched_domain *sd;
+	static int printed_cost = 0; /* has cost already been printed? */
 
 	j0 = jiffies;
 
@@ -5699,13 +5700,16 @@ static void calibrate_migration_costs(co
 			-1
 #endif
 		);
-	printk("migration_cost=");
-	for (distance = 0; distance <= max_distance; distance++) {
-		if (distance)
-			printk(",");
-		printk("%ld", (long)migration_cost[distance] / 1000);
+	if (!printed_cost) {
+		printed_cost++;
+		printk("migration_cost=");
+		for (distance = 0; distance <= max_distance; distance++) {
+			if (distance)
+				printk(",");
+			printk("%ld", (long)migration_cost[distance] / 1000);
+		}
+		printk("\n");
 	}
-	printk("\n");
 	j1 = jiffies;
 	if (migration_debug)
 		printk("migration: %ld seconds\n", (j1-j0)/HZ);
Signature · 6 lines
Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/