Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: How to disable hyperthreading?

  1. #1
    Join Date
    Apr 2010
    Beans
    10

    Cool How to disable hyperthreading?

    I'm on the pengolin with an i5, the cheapest cpu. Because it doesn't have a ton of kick it really kills me when a program that can only use one thread is only allowed use of half of one of the cores, which is basically every program I use.

    Correct me if I'm wrong about assuming that a program can only utilize 25% of the cpu if it's single threaded with hyperthreading on and up to 50% (a full core out of the two cores) with it disabled, but if that's the case I would absolutely love to try disabling it since watching my cpu graph generally shows it capped at 25%, which is ridiculous. I realize it's -possible- this is just a deceptive oversight of the design of the cpu graph, but probably not.

    Anyone have suggestions? Is this something I have to put into the grub config or what?

    (intermediate linux user)


    Thanks!

  2. #2
    Join Date
    Apr 2010
    Beans
    10

    Unhappy Re: How to disable hyperthreading?

    Anyone? Would really love some tips or hints on how to tackle this... The bios menu is basically worthless and mentions nothing about the cpu, is there nothing operating system level that can be done?

  3. #3
    Join Date
    Oct 2007
    Beans
    264

    Re: How to disable hyperthreading?

    Quote Originally Posted by jcwilk View Post
    I'm on the pengolin with an i5, the cheapest cpu. Because it doesn't have a ton of kick it really kills me when a program that can only use one thread is only allowed use of half of one of the cores, which is basically every program I use.

    Correct me if I'm wrong about assuming that a program can only utilize 25% of the cpu if it's single threaded with hyperthreading on and up to 50% (a full core out of the two cores) with it disabled, but if that's the case I would absolutely love to try disabling it since watching my cpu graph generally shows it capped at 25%, which is ridiculous. I realize it's -possible- this is just a deceptive oversight of the design of the cpu graph, but probably not.

    Anyone have suggestions? Is this something I have to put into the grub config or what?

    (intermediate linux user)


    Thanks!
    I read your post yesterday and decided not to answer as I was lazy to type everything out. Sorry. Here is my 0.02$.

    For a merely dual core CPU (i.e. no hyperthreading), what you need to be looking at is the CPU usage for a particular task in say "top". If it shows 25% there with default "top" settings, then you have a problem.

    For a single program/task, even with hyperthreading enabled, chances of reduced performance are negligible if not non-existent.

    With hyperthreading switched on, there can be one problem though; a problem that has been in existence ever since its introduction. Put simply, lets say you have two programs running, both of which typically tend to max out the CPU usage at 100%. If all you have is a simple dual-core, then the OS spreads out each program to a CPU core thus giving each program 100% CPU to work with. Of course each of these programs is free to hop from one CPU to another (assuming no CPU affinity constraints are in place).

    With hyperthreading on, there is always the possibility that both of the programs can be sent to two individual threads of the same CPU core. In this case, physically speaking, only one of the CPU cores is completely loaded even though "top" will gladly show that both programs are using 100% CPU. The result is that both programs run slowly. How slowly is another question...

    I have not been following Linux kernel development for quite a few years so I don't know if the kernel is now smart enough to automatically schedule two processes on two individual cores instead of random allocation? I do however know how to force the kernel to use two individual cores for any processes that I start on my own. The "taskset" command will help force CPU affinity. To identify which processor core/thread is from the same physical CPU identify two of the four processors that cat /proc/cpuinfo spews out and check for any two processors with different physical ids.

    For the most part however, I usually find that only folks very very obsessed with performance tend to worry about such things. No offence. For daily computing, it's much easier to trust the kernel devs and your distro and just move along

  4. #4
    Join Date
    Sep 2009
    Beans
    217

    Re: How to disable hyperthreading?

    I seem to recall a thread on the Archlinux forums on this subject. If I remember correctly, it was found that the kernel preferred to use even numbered cpus (ie. whole cpus) rather than allocating work to each cpu in sequence. However, if this isn't the behavior you are seeing then it's probably because the scheduler is older and doesn't yet know about core i3/5/7 cpus. In which case you should either compile a newer kernel or try 10.04 out.

  5. #5
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: How to disable hyperthreading?

    There is no need and no benefit in disabling hyperthreading (except for some very rare corner cases where you might see an tiny slowdown).

    Its not using half your cpu core, its using all its resources. Hyperthreading duplicates some resources allowing 2 threads to run on one core more or less simultaneously. For some apps that provides a nice speedup. Others, it doesnt. But it doesnt hurt to have those resources and not use them.

    You are just reading too much in to the 25% thing. Think of it as 25% of theoretical maximum load running 4 threads. If you disable hyperthreading, you reduce the maximum theoretical cpu throughput by half, so you will get 50% in the performance monitor using the same load, but it wont be any faster at all.

    in short: leave it on.

  6. #6
    Join Date
    Oct 2007
    Beans
    264

    Re: How to disable hyperthreading?

    Quote Originally Posted by P4man View Post
    There is no need and no benefit in disabling hyperthreading (except for some very rare corner cases where you might see an tiny slowdown).

    Its not using half your cpu core, its using all its resources. Hyperthreading duplicates some resources allowing 2 threads to run on one core more or less simultaneously. For some apps that provides a nice speedup. Others, it doesnt. But it doesnt hurt to have those resources and not use them.

    You are just reading too much in to the 25% thing. Think of it as 25% of theoretical maximum load running 4 threads. If you disable hyperthreading, you reduce the maximum theoretical cpu throughput by half, so you will get 50% in the performance monitor using the same load, but it wont be any faster at all.

    in short: leave it on.
    P4man is right. Well put

  7. #7
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,048
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to disable hyperthreading?

    sudo apt-get install htop

    htop

    It will show all four cores. I don't know why it's not included in the standard distro.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  8. #8
    Join Date
    Oct 2007
    Beans
    264

    Re: How to disable hyperthreading?

    Quote Originally Posted by tgalati4 View Post
    sudo apt-get install htop

    htop

    It will show all four cores. I don't know why it's not included in the standard distro.
    "top" can do that too. Just hit "1" after entering "top".

  9. #9
    Join Date
    Apr 2010
    Beans
    10

    Lightbulb Re: How to disable hyperthreading?

    Thanks guys, I really appreciate your thorough responses.

    Ok, so I guess I'm just being misled by top and system monitor saying it's seeing 4 cpus, am I correct in thinking that if one of these virtual cpus is getting maxed out and nothing else is using much cpu time, it will be allowed a full core despite the fact that it's 1 out of 4 virtual cpus?

    If that's the case then yeah, I agree that it would be overly anal to try and disable hyperthreading. I'll try to keep an eye on top when my cpu starts getting worked and see if this is the case or not and report back if it still seems like I'm only getting half a core per single thread, but you guys are probably right, thanks again for the explanations.

    UPDATE:

    So I just wrote a little ruby script (vanilla ruby is pretty guaranteed to only get one kernel thread) to just do squares and squareroots back and forth of a float and these are the cpu usages top is reporting:

    (without breaking it into individual virtual cpus)
    Cpu(s): 26.1%us, 0.2%sy, 0.0%ni, 73.6%id, 0.0%wa, 0.1%hi, 0.0%si, 0.0%st

    (with breaking it into individual cpus)
    Cpu0 : 4.5%us, 0.6%sy, 0.0%ni, 94.6%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Cpu1 : 0.0%us, 0.3%sy, 0.0%ni, 99.3%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Cpu2 : 99.7%us, 0.0%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.3%hi, 0.0%si, 0.0%st
    Cpu3 : 6.3%us, 0.6%sy, 0.0%ni, 92.8%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st

    As you can see it's very suggestive towards only getting half a core, or 1/4 of the total chip. I realize it's possible that the virtual cpu, Cpu2 in that case, is actually being allowed all of the resources of one of the cores and not just half of it, but it's super unclear... Anyone know of a more reliable way to determine what percentage of your core or total chip capacity a process is being given?

  10. #10
    Join Date
    Apr 2010
    Beans
    10

    Re: How to disable hyperthreading?

    Quote Originally Posted by P4man View Post
    There is no need and no benefit in disabling hyperthreading (except for some very rare corner cases where you might see an tiny slowdown).

    Its not using half your cpu core, its using all its resources. Hyperthreading duplicates some resources allowing 2 threads to run on one core more or less simultaneously. For some apps that provides a nice speedup. Others, it doesnt. But it doesnt hurt to have those resources and not use them.

    You are just reading too much in to the 25% thing. Think of it as 25% of theoretical maximum load running 4 threads. If you disable hyperthreading, you reduce the maximum theoretical cpu throughput by half, so you will get 50% in the performance monitor using the same load, but it wont be any faster at all.

    in short: leave it on.
    From what you're saying it sounds like turning hyperthreading on actually doubles the potential throughput of the cpu, which no offense, sounds a little too good to be true. Are there actually double the physical components in the core i5 as compared to a comparable non-hyperthreading core duo?

    I was under the impression that hyperthreading just improved general responsiveness since it makes it easier to break up the cores into smaller virtual parts which can be more readily shared between processes on the low level hardware layer... Which wouldn't provide any benefit to total cpu capacity. Am I incorrect in this thinking?

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •