Strange performance results on hyperthreading system

I have been checking a driver on a Hyperthreading machine (one physical
CPU) and have found the following strange results:

  • The best performance of my driver is achieved when I disable
    HyperThreading from BIOS (that is, no hyperthreding at all)
  • Second best is when I use the flag /ONECPU in BOOT.INI.
  • The worst, by far, is when I use HypertHreading and two logical CPUs.

My driver does a lot of memory management, although it does no allocate
much memory. Actually I move many blocks of memory on previously allocated
buffers.
I have checked that the critical performance bottleneck is precisely at
these routines that manage memory.
However, when I disable Hyperthreading from BIOS I get a huge improvement.
Actually it seems that when I have hyperthreading active I am punished on
memory intensive code.

I remember to have read that HT technology uses a different internal cache
scheme. I wonder if that would be related to this strange performance issue.

On the other hand, it seems that using ONECPU in BOOT.INI has not the same
effect that disabling HT on the BIOS.
That might mean that Windows plays some games with SMP even if one sets the
ONECPU option. Let me tell you that, in my driver, the difference in
performance between disabling HT by BIOS and disabling it by the ONECPU
flag is very noticeable.

Anyone finds any logical explanation ?

With Hyperthreading enabled, the on-chip cache on the CPU is divided between
the two logical CPUs. This means that threads running on one logical CPU will
not be able to use the portion of the cache set aside for the other logical
CPU. This also means that your effective cache size is split in half.

Supplying /ONECPU in BOOT.INI has the effect of telling Windows to only use one
CPU; however the other CPU is still there. The one CPU Windows will use still
only has half the cache, because the rest of the cache will sit idle in the
unused logical CPU.

So it seems that you are being hit by a severe case of cache misses. Which is
logical, considering that your driver is doing lots of memory moves.

Burk.

Dipl.-Ing. Burkhard Daniel

Professional System Software Engineering
xxxxx@system-software.net

Inaki Castillo wrote:

I have been checking a driver on a Hyperthreading machine (one physical
CPU) and have found the following strange results:

  • The best performance of my driver is achieved when I disable
    HyperThreading from BIOS (that is, no hyperthreding at all)
  • Second best is when I use the flag /ONECPU in BOOT.INI.
  • The worst, by far, is when I use HypertHreading and two logical CPUs.

My driver does a lot of memory management, although it does no allocate
much memory. Actually I move many blocks of memory on previously
allocated buffers.
I have checked that the critical performance bottleneck is precisely at
these routines that manage memory.
However, when I disable Hyperthreading from BIOS I get a huge
improvement. Actually it seems that when I have hyperthreading active I
am punished on memory intensive code.

I remember to have read that HT technology uses a different internal
cache scheme. I wonder if that would be related to this strange
performance issue.

On the other hand, it seems that using ONECPU in BOOT.INI has not the
same effect that disabling HT on the BIOS.
That might mean that Windows plays some games with SMP even if one sets
the ONECPU option. Let me tell you that, in my driver, the difference in
performance between disabling HT by BIOS and disabling it by the ONECPU
flag is very noticeable.

Anyone finds any logical explanation ?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256