Skip to contentSkip to conversation

smpboot: cachesize comparison fix in smp_tune_scheduling()

PATCH In review Jarek Poplawski 2 participants 3 messages May 24, 2007 – May 25, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smpboot: cachesize comparison fix in smp_tune_scheduling()

smpboot: cachesize comparison fix in smp_tune_scheduling()

boot_cpu_data.x86_cache_size is signed int and can be < 0 too.

PS: this function is removed from current -mm.

---

arch/i386/kernel/smpboot.c +1 -1
diff -Nurp 2.6.22-rc2-git5-/arch/i386/kernel/smpboot.c 2.6.22-rc2-git5/arch/i386/kernel/smpboot.c
@@ -948,7 +948,7 @@ static void smp_tune_scheduling(void)
 	if (cpu_khz) {
 		cachesize = boot_cpu_data.x86_cache_size;
 
-		if (cachesize > 0)
+		if ((long)cachesize > 0)
 			max_cache_size = cachesize * 1024;
 	}
 }
#1 lore raw
Quoted 16 lines · On Thu, 24 May 2007 12:33:23 +0200 Jarek Poplawski <[email protected]> wrote:

smpboot: cachesize comparison fix in smp_tune_scheduling()

boot_cpu_data.x86_cache_size is signed int and can be < 0 too.

PS: this function is removed from current -mm.

---

diff -Nurp 2.6.22-rc2-git5-/arch/i386/kernel/smpboot.c 2.6.22-rc2-git5/arch/i386/kernel/smpboot.c

arch/i386/kernel/smpboot.c static void smp_tune_scheduling(void) · line 954

Quoted 8 lines
arch/i386/kernel/smpboot.c +1 -1
@@ -948,7 +948,7 @@ static void smp_tune_scheduling(void)
 	if (cpu_khz) {
 		cachesize = boot_cpu_data.x86_cache_size;
 
-		if (cachesize > 0)
+		if ((long)cachesize > 0)
 			max_cache_size = cachesize * 1024;
 	}
 }

Under what conditions can boot_cpu_data.x86_cache_size be negative?

Have negative values of boot_cpu_data.x86_cache_size been observed in practice?

Thanks.

#2 lore raw
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Thu, 24 May 2007 12:33:23 +0200 Jarek Poplawski <[email protected]> wrote:

smpboot: cachesize comparison fix in smp_tune_scheduling()

boot_cpu_data.x86_cache_size is signed int and can be < 0 too.

...

Quoted 4 lines

Under what conditions can boot_cpu_data.x86_cache_size be negative?

Have negative values of boot_cpu_data.x86_cache_size been observed in practice?

Sorry, but IMHO every observations are only kind of illusions, and should have no influence on any serious science, including computer science.

But, from smpboot.c history:

"[PATCH] i386: Clean up smp_tune_scheduling()
Adrian Bunk [Thu, 7 Dec 2006 01:14:19 +0000 (02:14 +0100)]
- remove the write-only local variable "bandwidth"
- don't set "max_cache_size" in the (cachesize < 0) case:
that's already handled in kernel/sched.c:measure_migration_cost()"

So, it seems such strange phenomenon could've been observed long time ago...

Thanks,
Jarek P.