Skip to contentSkip to conversation

+ i386-time-avoid-pit-smp-lockups.patch added to -mm tree

DISCUSSION Daniel Walker 4 participants 11 messages Oct 19, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

arch/i386/kernel/i8253.c static struct clocksource clocksource_pi · line 114

Quoted 11 lines · On Wed, 2006-10-11 at 14:26 -0700, [email protected] wrote:

diff -puN arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups arch/i386/kernel/i8253.c

arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +1 -1
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pi
 
 static int __init init_pit_clocksource(void)
 {
-	if (num_possible_cpus() > 4) /* PIT does not scale! */
+	if (num_possible_cpus() > 1) /* PIT does not scale! */
 		return 0;
 

Can we ifdef some code here on CONFIG_SMP . It bugs me that there just dead code laying around on smp systems.

Daniel

#2 lore raw
Quoted 7 lines · Daniel Walker
Quoted 5 lines · On Wed, 2006-10-11 at 14:26 -0700, [email protected] wrote:

diff -puN arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups arch/i386/kernel/i8253.c

arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +0 -0
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pi
 
Quoted 9 lines

arch/i386/kernel/i8253.c static struct clocksource clocksource_pi · line 114

Quoted 6 lines
arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +1 -1
 static int __init init_pit_clocksource(void)
 {
-	if (num_possible_cpus() > 4) /* PIT does not scale! */
+	if (num_possible_cpus() > 1) /* PIT does not scale! */
 		return 0;
 

Can we ifdef some code here on CONFIG_SMP . It bugs me that there just dead code laying around on smp systems.

The optimizer should optimize it all out since num_possible_cpus() is a 0 constant on UP.

-Andi

#3 lore raw
Quoted 18 lines · Andi Kleen
Quoted 7 lines · Daniel Walker
Quoted 5 lines · On Wed, 2006-10-11 at 14:26 -0700, [email protected] wrote:

diff -puN arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups arch/i386/kernel/i8253.c

arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +0 -0
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pi
 
Quoted 9 lines

arch/i386/kernel/i8253.c static struct clocksource clocksource_pi · line 114

Quoted 6 lines
arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +1 -1
 static int __init init_pit_clocksource(void)
 {
-	if (num_possible_cpus() > 4) /* PIT does not scale! */
+	if (num_possible_cpus() > 1) /* PIT does not scale! */
 		return 0;
 

Can we ifdef some code here on CONFIG_SMP . It bugs me that there just dead code laying around on smp systems.

Quoted 2 lines

The optimizer should optimize it all out since num_possible_cpus() is a 0 constant on UP.

You just mean the if statement above though? I was talking more about the structure above this called "clocksource_pit" which isn't used on SMP systems due to this code addition. AFAIK init_pit_clocksource() could disappear along with the clocksource structure ..

Daniel

#4 lore raw
Quoted 5 lines

You just mean the if statement above though? I was talking more about the structure above this called "clocksource_pit" which isn't used on SMP systems due to this code addition. AFAIK init_pit_clocksource() could disappear along with the clocksource structure ..

It will end up as a int f() { return 0; }. Not very much overhead.

-Andi

#5 lore raw
Quoted 8 lines · Andi Kleen
Quoted 4 lines

You just mean the if statement above though? I was talking more about the structure above this called "clocksource_pit" which isn't used on SMP systems due to this code addition. AFAIK init_pit_clocksource() could disappear along with the clocksource structure ..

It will end up as a int f() { return 0; }. Not very much overhead.

-Andi

Here's what I found ..

-rwxr-xr-x 1 dwalker engr 48252535 Oct 19 07:47 vmlinux -rwxr-xr-x 1 dwalker engr 48249958 Oct 19 07:47 vmlinux.ifdef

So we're talking about ~2.5k of code including the pit_read and clocksource structure.

Daniel

#6 lore raw
In reply to Daniel Walker
Quoted 22 lines · Daniel Walker
Quoted 20 lines · Andi Kleen
Quoted 17 lines · Daniel Walker

arch/i386/kernel/i8253.c static struct clocksource clocksource_pi · line 114

Quoted 11 lines · On Wed, 2006-10-11 at 14:26 -0700, [email protected] wrote:

diff -puN arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups arch/i386/kernel/i8253.c

arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +1 -1
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pi
 
 static int __init init_pit_clocksource(void)
 {
-	if (num_possible_cpus() > 4) /* PIT does not scale! */
+	if (num_possible_cpus() > 1) /* PIT does not scale! */
 		return 0;
 

Can we ifdef some code here on CONFIG_SMP . It bugs me that there just dead code laying around on smp systems.

Quoted 8 lines
Quoted 2 lines

The optimizer should optimize it all out since num_possible_cpus() is a 0 constant on UP.

You just mean the if statement above though? I was talking more about the structure above this called "clocksource_pit" which isn't used on SMP systems due to this code addition. AFAIK init_pit_clocksource() could disappear along with the clocksource structure ..

An SMP kernel can boot on UP hardware, in which case I think num_possible_cpus() will be 1, won't it?

Signature · 2 lines
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 
#7 lore raw
Quoted 3 lines

An SMP kernel can boot on UP hardware, in which case I think num_possible_cpus() will be 1, won't it?

0 was a typo, i meant 1 for UP of course. 0 would be nonsensical.

-Andi

#8 lore raw
Quoted 5 lines · Andi Kleen
Quoted 2 lines

An SMP kernel can boot on UP hardware, in which case I think num_possible_cpus() will be 1, won't it?

0 was a typo, i meant 1 for UP of course. 0 would be nonsensical.

Sure, I realised that. For a UP kernel, the test will compile away.

But Daniel seems to say there is dead code that could be compiled out for SMP kernels. I just don't think that is possible because the SMP kernel can boot a UP system where num_possible_cpus() is 1.

Signature · 2 lines
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 
#9 lore raw
Quoted 5 lines · Nick Piggin
Quoted 4 lines · Andi Kleen
Quoted 2 lines

An SMP kernel can boot on UP hardware, in which case I think num_possible_cpus() will be 1, won't it?

Quoted 7 lines
Quoted 1 line

0 was a typo, i meant 1 for UP of course. 0 would be nonsensical.

Sure, I realised that. For a UP kernel, the test will compile away.

But Daniel seems to say there is dead code that could be compiled out for SMP kernels. I just don't think that is possible because the SMP kernel can boot a UP system where num_possible_cpus() is 1.

I thought he meant !CONFIG_SMP kernels.

-Andi

#10 lore raw
Quoted 8 lines · Andi Kleen
Quoted 7 lines · Nick Piggin
Quoted 5 lines · Andi Kleen
Quoted 2 lines

An SMP kernel can boot on UP hardware, in which case I think num_possible_cpus() will be 1, won't it?

0 was a typo, i meant 1 for UP of course. 0 would be nonsensical.

Quoted 7 lines
Quoted 5 lines

Sure, I realised that. For a UP kernel, the test will compile away.

But Daniel seems to say there is dead code that could be compiled out for SMP kernels. I just don't think that is possible because the SMP kernel can boot a UP system where num_possible_cpus() is 1.

I thought he meant !CONFIG_SMP kernels.

definitely CONFIG_SMP=y . The code block I quoted would disable the PIT clocksource w/ more than one cpu. So the pit clocksource is just dead weight on SMP systems. However, like Nick was saying it's possible to boot CONFIG_SMP on a UP system, but removing the pit in that situation may not hurt anything.

Daniel

#11 lore raw
In reply to Daniel Walker
Quoted 7 lines · Daniel Walker
Quoted 5 lines · On Wed, 2006-10-11 at 14:26 -0700, [email protected] wrote:

diff -puN arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups arch/i386/kernel/i8253.c

arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +0 -0
@@ -109,7 +109,7 @@ static struct clocksource clocksource_pi
 
Quoted 9 lines

arch/i386/kernel/i8253.c static struct clocksource clocksource_pi · line 114

Quoted 6 lines
arch/i386/kernel/i8253.c renamed from arch/i386/kernel/i8253.c~i386-time-avoid-pit-smp-lockups +1 -1
 static int __init init_pit_clocksource(void)
 {
-	if (num_possible_cpus() > 4) /* PIT does not scale! */
+	if (num_possible_cpus() > 1) /* PIT does not scale! */
 		return 0;
 

Can we ifdef some code here on CONFIG_SMP . It bugs me that there just dead code laying around on smp systems.

I still want the pit to be available on SMP kernels that boot on UP systems, so I don't think an ifdef will do it. Maybe it would be possible to do some smp alternatives-like code removal on SMP systems?

thanks
-john