The FreeBSD by default "disables" hyper-threading cores, by not scheduling

any threads to them. However, it still counts those cores as "active but
permanently idle" when calculating system-wide CPUs statistics. It is
incorrect, since it skews statistics quite a bit and creates real problems
for certain types of applications (monitoring applications for example),
by making them believe that the system does have enough idle CPU resources,
while in fact it does not.

Correct the problem by not calling performance counting routines on "disabled"
cores. The cleaner solution would be to just disable APIC timer interrupts on
those cores completely, but ENOTIME here and it is not clear if the
additional complexity really worth minor performance gain.

Reviewed by:	ssouhlal
Sponsored by:	Sippy Software, Inc.
MFC after:	2 weeks
This commit is contained in:
Maxim Sobolev 2006-09-05 17:15:24 +00:00
parent f031f0c03d
commit 23da540855
2 changed files with 20 additions and 0 deletions

View File

@ -613,6 +613,16 @@ lapic_handle_timer(struct trapframe frame)
/* Send EOI first thing. */
lapic_eoi();
/*
* Don't do any accounting for the disabled HTT cores, since it
* will provide misleading numbers for the userland.
*
* No locking is necessary here, since even if we loose the race
* when hlt_cpus_mask changes it is not a big deal, really.
*/
if ((hlt_cpus_mask & (1 << PCPU_GET(cpuid))) != 0)
return;
/* Look up our local APIC structure for the tick counters. */
la = &lapics[PCPU_GET(apic_id)];
(*la->la_timer_count)++;

View File

@ -615,6 +615,16 @@ lapic_handle_timer(struct trapframe frame)
/* Send EOI first thing. */
lapic_eoi();
/*
* Don't do any accounting for the disabled HTT cores, since it
* will provide misleading numbers for the userland.
*
* No locking is necessary here, since even if we loose the race
* when hlt_cpus_mask changes it is not a big deal, really.
*/
if ((hlt_cpus_mask & (1 << PCPU_GET(cpuid))) != 0)
return;
/* Look up our local APIC structure for the tick counters. */
la = &lapics[PCPU_GET(apic_id)];
(*la->la_timer_count)++;