LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   SMP and Hyperthreading on single-core processor x86 (https://www.linuxquestions.org/questions/linux-kernel-70/smp-and-hyperthreading-on-single-core-processor-x86-4175608811/)

adolfoe 06-28-2017 06:57 PM

SMP and Hyperthreading on single-core processor x86
 
Is there any consequence on enabling the SMP and HT kernel capabilities if you are going to use an x86 single core processor?

Is it better to disable those features? Is there any advantage on disabling them?

Thanks in advance for your help.

Laserbeak 06-28-2017 07:29 PM

If only have one processor, SMP is a moot issue, isn't it? Wouldn't that require more than one processor or at least core?

As far as hyper threading, I don't see why you would turn it off.

syg00 06-28-2017 07:55 PM

I must say I was surprised by the question. Been so long since I had even considered it, I thought it would no longer even be an option. But it is ... On my 4.12 rc5 kernel, the help (still) says
Code:

CONFIG_SMP:                                                                                                                                                  │ 
  │                                                                                                                                                              │ 
  │ This enables support for systems with more than one CPU. If you have                                                                                        │ 
  │ a system with only one CPU, say N. If you have a system with more                                                                                            │ 
  │ than one CPU, say Y.

There is more of the same. I was going to opine that it wouldn't matter, but I would defer to the build authors.

cwizardone 06-28-2017 08:23 PM

If a single core processor also has hyperthreading, as did the Intel P-4 processors, wouldn't you want to use the SMP kernel?

syg00 06-28-2017 09:08 PM

It would (presumably) still be just the one core - cpuinfo will show that. SMT is a scheduler option - specifically for the P4 according to the help.
I have an old P4 gathering dust somewhere, but I'm pretty sure it wasn't single core. I'll go look for it later.

syg00 06-28-2017 11:16 PM

Looking at my dust collector, which actually is a single core hyperthreaded P4, it doesn't seem to matter. The default Fedora config has it as SMP - been a long time since anyone shipped both a UP and SMP kernel set. Relevant info:
Code:

----cpuinfo--------
processor        : 0
physical id        : 0
siblings        : 2
core id                : 0
cpu cores        : 1
processor        : 1
physical id        : 0
siblings        : 2
core id                : 0
cpu cores        : 1
----config---------
CONFIG_X86_32_SMP=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_SMP=y
CONFIG_X86_BIGSMP=y
CONFIG_SCHED_SMT=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_SCSI_SAS_HOST_SMP=y
CONFIG_I2C_ISMT=m
CONFIG_VIDEO_VP27SMPX=m
----inxi-----------
CPU:      Single core Intel Pentium 4 (-HT-) cache: 512 KB
          clock speeds: max: 2800 MHz 1: 2800 MHz 2: 2800 MHz


cwizardone 06-29-2017 03:58 AM

One of my old boxes was a 64 bit single core Intel P-4 with Hyperthreading that the kernel reported as a dual core.

IsaacKuo 06-29-2017 08:46 AM

My experience is there is no significant consequence. I mean, if you really want to scrimp and save on a few bytes of RAM and imperceptibly improving boot time, then getting rid of the modules can help.

But otherwise, why bother with the extra effort?

I had (before it just died a couple months ago) a 64 bit hyperthreading P4 and it worked fine. Also, I have a couple old Atom based machines, which are 32 bit hyperthreading. In both cases, the kernel reports two cores.

I also have a LOT of 32 bit Socket 732 AMD Sempron machines, all of them boring single core and they work fine with those modules in the kernel.

Basically, I just use the vanilla Debian 686-pae and amd64 kernels, no tweaking on my part. They include those modules, and it basically all just works out-of-box. Single core, dual core, quad core, hyperthreading, no hyperthreading, 32 bit, 64 bit...it all just works.

syg00 06-29-2017 09:01 AM

Agreed. I remember using gentoo on my P4. Very little buy-back from compiling all night to change something like this. Just run with what you have unless you have real good reasons not to.

sundialsvcs 06-29-2017 09:10 AM

My experience with Hyperthreading is also that it is mostly smoke-and-mirrors. The concept was to exploit a peculiarity of the physical instruction pipeline to allow for the illusion of "two cores" when there is only one physical execution unit. And, if a real-world workload actually consisted of balls-to-the-walls ;) CPU activity, which never needed to flush the pipeline, it might produce some improvement. (But, certainly not "+100%.") However, it fools the operating system into thinking that there really are two cores there.

In my experience, "if you need multiple cores," buy a chip that supports them – and the accompanying motherboard, which must actually have the memory hardware needed to actually do SMP. (Even though "cores" are not really "SMP" at all.) Fair warning: plenty of systems are sold with fancy-pants chipsets without the supporting hardware needed to actually let them be of any use.

Laserbeak 06-29-2017 09:22 AM

Quote:

Originally Posted by sundialsvcs (Post 5728711)
My experience with Hyperthreading is also that it is mostly smoke-and-mirrors. The concept was to exploit a peculiarity of the physical instruction pipeline to allow for the illusion of "two cores" when there is only one physical execution unit. And, if a real-world workload actually consisted of balls-to-the-walls ;) CPU activity, which never needed to flush the pipeline, it might produce some improvement. (But, certainly not "+100%.") However, it fools the operating system into thinking that there really are two cores there.

In my experience, "if you need multiple cores," buy a chip that supports them – and the accompanying motherboard, which must actually have the memory hardware needed to actually do SMP. (Even though "cores" are not really "SMP" at all.) Fair warning: plenty of systems are sold with fancy-pants chipsets without the supporting hardware needed to actually let them be of any use.

As an Apple guy all my life, I'm fairly new to Intel, but as I understand it there are some things hyperthreading can do in parallel and some things it can't. I'm not sure off the top of my head what is what. But I have a MacBook Pro with a single Core i7 processor that shows up as having 8 processors but I think it's not any faster than my older Mac Pro that has two real Xeon processors with two non-hyperthreading cores each and shows up as four processors.

cwizardone 06-29-2017 10:29 AM

An Intel i7 should be a quad core chip, so with Hyperthreading you would see eight cores.

cynwulf 06-29-2017 11:04 AM

If you have a single core 32 bit CPU which is older than a Pentium 4, you may as well build a "pentium pro" (P6) kernel with PAE/NX support enabled, but without SMP or HT support.

Laserbeak 06-29-2017 06:54 PM

Quote:

Originally Posted by cwizardone (Post 5728754)
An Intel i7 should be a quad core chip, so with Hyperthreading you would see eight cores.

Yes, and it does show up as 8 processors, as I said. Usually only re-encoding a movie or something can get all eight to near 100%.

sundialsvcs 06-30-2017 06:41 AM

Hyperthreading is basically a marketer's illusion to make the system appear to be twice as big as it really is. :rolleyes:

If you have a single-core CPU, you should compile Linux without SMP support. This will eliminate a lot of locking and synchronization code within the kernel that you simply do not need.

If you do, cut the number of perceived CPUs in half and the system just might run faster.


All times are GMT -5. The time now is 02:44 PM.