Can i tell my Linux machine use only Physical Cores?How do I know which processors are physical cores?Can I...

How to determine passing chords

Charges from Dollar General have never shown up on my debit card - how to resolve?

Mapping string into integers

How to prove that invoices are really unpaid?

Is it safe to pay bills over satellite internet?

Are there any spells that enhance ranged attacks like some melee attack spells do for melee attacks

What are the branches of statistics?

How are Aircraft Noses Designed?

Does my protagonist need to be the most important character?

Hero battle game

Which culture used no personal names?

Where does the upgrade to macOS Catalina move root "/" directory files?

What could possibly power an Alcubierre drive?

"A tin of biscuits" vs "A biscuit tin"

Is it a bad idea to get a PhD?

Are dead worlds a good galactic barrier?

How do I get my boyfriend to remove pictures of his ex girlfriend hanging in his apartment?

How can I communicate feelings to players without impacting their agency?

Is a list of the most common English words copyrightable?

How do you handle simultaneous damage when one type is absorbed and not the other?

Trade a bishop in the opening

When did MCMC become commonplace?

Meaning of 'pound' in "felt a fury that was not his own pound through his body"

When to use the gestalt principle of common region?



Can i tell my Linux machine use only Physical Cores?


How do I know which processors are physical cores?Can I run multiple cores at different clock speeds?Telling Linux kernel *not* to use certain CPUsCan the 0th physical core used asymmetrically on linux?VirtualBox: Is it a bad idea to assign more virtual CPU cores than number of physical CPU coresis it possible to run process that use only 2 CPU from 16 CPU in my linux machineVirtual Machine Linux OS






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}








0

















I have a Linux Machine with 2 X5650 2.7GHZ Processors and I host game servers on it for my gaming community, and there comes my issue:
game servers need best 1 core performance, but I have 24 vCORES and 12 Physical Cores.
Is it possible to "tell" kernel use 12 physical cores? and then 1 physical core will use 2VCORES?



Thanks,
Alex.










share|improve this question



























  • If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads.

    – dsstorefile1
    Feb 28 '18 at 2:47













  • @dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance.

    – Alex Ulmer
    Feb 28 '18 at 2:53











  • I believe each of the "servers" are merely separate applications running on one operating system.

    – Jesse_b
    Feb 28 '18 at 2:57











  • I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired.

    – dsstorefile1
    Feb 28 '18 at 2:58











  • @dsstorefile it cannot be done globally? without pinning processes to a specific core?

    – Alex Ulmer
    Feb 28 '18 at 3:14


















0

















I have a Linux Machine with 2 X5650 2.7GHZ Processors and I host game servers on it for my gaming community, and there comes my issue:
game servers need best 1 core performance, but I have 24 vCORES and 12 Physical Cores.
Is it possible to "tell" kernel use 12 physical cores? and then 1 physical core will use 2VCORES?



Thanks,
Alex.










share|improve this question



























  • If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads.

    – dsstorefile1
    Feb 28 '18 at 2:47













  • @dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance.

    – Alex Ulmer
    Feb 28 '18 at 2:53











  • I believe each of the "servers" are merely separate applications running on one operating system.

    – Jesse_b
    Feb 28 '18 at 2:57











  • I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired.

    – dsstorefile1
    Feb 28 '18 at 2:58











  • @dsstorefile it cannot be done globally? without pinning processes to a specific core?

    – Alex Ulmer
    Feb 28 '18 at 3:14














0












0








0








I have a Linux Machine with 2 X5650 2.7GHZ Processors and I host game servers on it for my gaming community, and there comes my issue:
game servers need best 1 core performance, but I have 24 vCORES and 12 Physical Cores.
Is it possible to "tell" kernel use 12 physical cores? and then 1 physical core will use 2VCORES?



Thanks,
Alex.










share|improve this question














I have a Linux Machine with 2 X5650 2.7GHZ Processors and I host game servers on it for my gaming community, and there comes my issue:
game servers need best 1 core performance, but I have 24 vCORES and 12 Physical Cores.
Is it possible to "tell" kernel use 12 physical cores? and then 1 physical core will use 2VCORES?



Thanks,
Alex.







rhel kernel cpu cpu-frequency






share|improve this question













share|improve this question











share|improve this question




share|improve this question



share|improve this question










asked Feb 28 '18 at 2:44









Alex UlmerAlex Ulmer

1




1
















  • If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads.

    – dsstorefile1
    Feb 28 '18 at 2:47













  • @dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance.

    – Alex Ulmer
    Feb 28 '18 at 2:53











  • I believe each of the "servers" are merely separate applications running on one operating system.

    – Jesse_b
    Feb 28 '18 at 2:57











  • I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired.

    – dsstorefile1
    Feb 28 '18 at 2:58











  • @dsstorefile it cannot be done globally? without pinning processes to a specific core?

    – Alex Ulmer
    Feb 28 '18 at 3:14



















  • If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads.

    – dsstorefile1
    Feb 28 '18 at 2:47













  • @dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance.

    – Alex Ulmer
    Feb 28 '18 at 2:53











  • I believe each of the "servers" are merely separate applications running on one operating system.

    – Jesse_b
    Feb 28 '18 at 2:57











  • I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired.

    – dsstorefile1
    Feb 28 '18 at 2:58











  • @dsstorefile it cannot be done globally? without pinning processes to a specific core?

    – Alex Ulmer
    Feb 28 '18 at 3:14

















If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads.

– dsstorefile1
Feb 28 '18 at 2:47







If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads.

– dsstorefile1
Feb 28 '18 at 2:47















@dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance.

– Alex Ulmer
Feb 28 '18 at 2:53





@dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance.

– Alex Ulmer
Feb 28 '18 at 2:53













I believe each of the "servers" are merely separate applications running on one operating system.

– Jesse_b
Feb 28 '18 at 2:57





I believe each of the "servers" are merely separate applications running on one operating system.

– Jesse_b
Feb 28 '18 at 2:57













I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired.

– dsstorefile1
Feb 28 '18 at 2:58





I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired.

– dsstorefile1
Feb 28 '18 at 2:58













@dsstorefile it cannot be done globally? without pinning processes to a specific core?

– Alex Ulmer
Feb 28 '18 at 3:14





@dsstorefile it cannot be done globally? without pinning processes to a specific core?

– Alex Ulmer
Feb 28 '18 at 3:14










2 Answers
2






active

oldest

votes


















2


















You can use taskset to manually distribute processes across cores by setting their thread affinities. To figure out which threads belong to which cores and processors, check /proc/cpuinfo as shown below:



$ grep -E '^processor|^physical id|^core id' /proc/cpuinfo |sed 's/^processor/nprocessor/'

processor : 0
physical id : 0
core id : 0

processor : 1
physical id : 0
core id : 1

processor : 2
physical id : 0
core id : 0

processor : 3
physical id : 0
core id : 1
$ _


processor is the thread number, physical id is the physical CPU number, and core id is the core number. The above output comes from a machine with a single CPU with two cores and four threads.



taskset can be used as taskset --all-tasks -p <hex_mask> <pid> to modify the affinity of all threads of an extant process. The hex_mask is a bitmask where each 1 bit represents an assigned CPU thread and numbering starts from the right. For instance, 0xa for the mask means binary 0b1010 which indicates an affinity of thread #1 and thread #3 for the process. The PID, I hope, is self-explanatory.






share|improve this answer


































    0


















    Virtual Cores or "Threads"



    If you want to avoid virtual cores or "threads", then you could simply disable the feature. Although, disabling this feature not necessarily will improve performance, that depends on the server software you are running (there are engines that work better with HT/SMT, while others don't), you should probably test it.



    According to your post, the Intel X5650 has 6 Cores and 12 Threads each. You can verify this with lscpu. For ex. the following CPU has 4 Cores and the HT disabled:



    $ lscpu
    Architecture: x86_64
    CPU op-mode(s): 32-bit, 64-bit
    Byte Order: Little Endian
    CPU(s): 4
    On-line CPU(s) list: 0-3
    Thread(s) per core: 1
    Core(s) per socket: 4
    Socket(s): 1


    You can verify the HT cores by running:



    # grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list


    This will output something like:



    $  grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list
    /sys/devices/system/cpu/cpu0/topology/thread_siblings_list:X,Y
    /sys/devices/system/cpu/cpu1/topology/thread_siblings_list:X,Y
    /sys/devices/system/cpu/cpu2/topology/thread_siblings_list:X,Y
    /sys/devices/system/cpu/cpu3/topology/thread_siblings_list:X,Y


    Where X,Y are Physical-Core-ID,HT-Core-ID, as in: 0,4 (the first virtual core ID usually is the next to the last physical one).



    Disabling Hyper-Threading



    With this information you have 2 options to disable the HT, depending on your access to the server:





    1. Through the BIOS settings (the easiest)




      • You should check your Motherboard manufacturer manual, and disable the Hyper-Threading there. This requires the server to reboot and access to the BIOS settings.




    2. Through the command line (no need to reboot)




      • You could disable each virtual core in Linux directly, create a disablevcore.sh file:




        #!/bin/bash
    for i in {YY..YY}; do
    echo "Disabling logical HT core $i."
    echo 0 > /sys/devices/system/cpu/cpu${i}/online;
    done


    And replace YY..YY for the threads ID you want to disable, according to your processors, probably {6..11}. Although I'm not sure how the numbering works on multi-socket setups, so you should check carefully.





    1. Another option (2.a if you will) is to disable it in GRUB:




      • Edit the GRUB config file: /etc/sysconfig/grub (if and append noht in the line that starts with: GRUB_CMDLINE_LINUX. It should be something like this:




    GRUB_CMDLINE_LINUX="... noht ..."




    More about HT and SMT:



    Intel "Hyper-Threading"




    Hyper-threading is Intel's proprietary simultaneous multithreading
    implementation used to improve parallelization of computations
    performed on x86 microprocessors. It first appeared in February 2002
    on Xeon server processors and in November 2002 on Pentium 4 desktop
    CPUs. Later, Intel included this technology in Itanium, Atom, and Core
    'i' Series CPUs, among others.




    https://en.wikipedia.org/wiki/Hyper-threading



    AMD "Simultaneus Multithreading (SMT)"




    Simultaneous multithreading is a technique for improving the overall
    efficiency of superscalar CPUs with hardware multithreading. SMT
    permits multiple independent threads of execution to better utilize
    the resources provided by modern processor architectures.




    https://en.wikipedia.org/wiki/Simultaneous_multithreading



    More details on disabling HT through the kernel:



    https://www.golinuxhub.com/2018/01/how-to-disable-or-enable-hyper.html






    share|improve this answer




























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });















      draft saved

      draft discarded
















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f427068%2fcan-i-tell-my-linux-machine-use-only-physical-cores%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown


























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2


















      You can use taskset to manually distribute processes across cores by setting their thread affinities. To figure out which threads belong to which cores and processors, check /proc/cpuinfo as shown below:



      $ grep -E '^processor|^physical id|^core id' /proc/cpuinfo |sed 's/^processor/nprocessor/'

      processor : 0
      physical id : 0
      core id : 0

      processor : 1
      physical id : 0
      core id : 1

      processor : 2
      physical id : 0
      core id : 0

      processor : 3
      physical id : 0
      core id : 1
      $ _


      processor is the thread number, physical id is the physical CPU number, and core id is the core number. The above output comes from a machine with a single CPU with two cores and four threads.



      taskset can be used as taskset --all-tasks -p <hex_mask> <pid> to modify the affinity of all threads of an extant process. The hex_mask is a bitmask where each 1 bit represents an assigned CPU thread and numbering starts from the right. For instance, 0xa for the mask means binary 0b1010 which indicates an affinity of thread #1 and thread #3 for the process. The PID, I hope, is self-explanatory.






      share|improve this answer































        2


















        You can use taskset to manually distribute processes across cores by setting their thread affinities. To figure out which threads belong to which cores and processors, check /proc/cpuinfo as shown below:



        $ grep -E '^processor|^physical id|^core id' /proc/cpuinfo |sed 's/^processor/nprocessor/'

        processor : 0
        physical id : 0
        core id : 0

        processor : 1
        physical id : 0
        core id : 1

        processor : 2
        physical id : 0
        core id : 0

        processor : 3
        physical id : 0
        core id : 1
        $ _


        processor is the thread number, physical id is the physical CPU number, and core id is the core number. The above output comes from a machine with a single CPU with two cores and four threads.



        taskset can be used as taskset --all-tasks -p <hex_mask> <pid> to modify the affinity of all threads of an extant process. The hex_mask is a bitmask where each 1 bit represents an assigned CPU thread and numbering starts from the right. For instance, 0xa for the mask means binary 0b1010 which indicates an affinity of thread #1 and thread #3 for the process. The PID, I hope, is self-explanatory.






        share|improve this answer





























          2














          2










          2









          You can use taskset to manually distribute processes across cores by setting their thread affinities. To figure out which threads belong to which cores and processors, check /proc/cpuinfo as shown below:



          $ grep -E '^processor|^physical id|^core id' /proc/cpuinfo |sed 's/^processor/nprocessor/'

          processor : 0
          physical id : 0
          core id : 0

          processor : 1
          physical id : 0
          core id : 1

          processor : 2
          physical id : 0
          core id : 0

          processor : 3
          physical id : 0
          core id : 1
          $ _


          processor is the thread number, physical id is the physical CPU number, and core id is the core number. The above output comes from a machine with a single CPU with two cores and four threads.



          taskset can be used as taskset --all-tasks -p <hex_mask> <pid> to modify the affinity of all threads of an extant process. The hex_mask is a bitmask where each 1 bit represents an assigned CPU thread and numbering starts from the right. For instance, 0xa for the mask means binary 0b1010 which indicates an affinity of thread #1 and thread #3 for the process. The PID, I hope, is self-explanatory.






          share|improve this answer














          You can use taskset to manually distribute processes across cores by setting their thread affinities. To figure out which threads belong to which cores and processors, check /proc/cpuinfo as shown below:



          $ grep -E '^processor|^physical id|^core id' /proc/cpuinfo |sed 's/^processor/nprocessor/'

          processor : 0
          physical id : 0
          core id : 0

          processor : 1
          physical id : 0
          core id : 1

          processor : 2
          physical id : 0
          core id : 0

          processor : 3
          physical id : 0
          core id : 1
          $ _


          processor is the thread number, physical id is the physical CPU number, and core id is the core number. The above output comes from a machine with a single CPU with two cores and four threads.



          taskset can be used as taskset --all-tasks -p <hex_mask> <pid> to modify the affinity of all threads of an extant process. The hex_mask is a bitmask where each 1 bit represents an assigned CPU thread and numbering starts from the right. For instance, 0xa for the mask means binary 0b1010 which indicates an affinity of thread #1 and thread #3 for the process. The PID, I hope, is self-explanatory.







          share|improve this answer













          share|improve this answer




          share|improve this answer



          share|improve this answer










          answered Feb 28 '18 at 3:14









          dsstorefile1dsstorefile1

          1,9623 silver badges15 bronze badges




          1,9623 silver badges15 bronze badges




























              0


















              Virtual Cores or "Threads"



              If you want to avoid virtual cores or "threads", then you could simply disable the feature. Although, disabling this feature not necessarily will improve performance, that depends on the server software you are running (there are engines that work better with HT/SMT, while others don't), you should probably test it.



              According to your post, the Intel X5650 has 6 Cores and 12 Threads each. You can verify this with lscpu. For ex. the following CPU has 4 Cores and the HT disabled:



              $ lscpu
              Architecture: x86_64
              CPU op-mode(s): 32-bit, 64-bit
              Byte Order: Little Endian
              CPU(s): 4
              On-line CPU(s) list: 0-3
              Thread(s) per core: 1
              Core(s) per socket: 4
              Socket(s): 1


              You can verify the HT cores by running:



              # grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list


              This will output something like:



              $  grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list
              /sys/devices/system/cpu/cpu0/topology/thread_siblings_list:X,Y
              /sys/devices/system/cpu/cpu1/topology/thread_siblings_list:X,Y
              /sys/devices/system/cpu/cpu2/topology/thread_siblings_list:X,Y
              /sys/devices/system/cpu/cpu3/topology/thread_siblings_list:X,Y


              Where X,Y are Physical-Core-ID,HT-Core-ID, as in: 0,4 (the first virtual core ID usually is the next to the last physical one).



              Disabling Hyper-Threading



              With this information you have 2 options to disable the HT, depending on your access to the server:





              1. Through the BIOS settings (the easiest)




                • You should check your Motherboard manufacturer manual, and disable the Hyper-Threading there. This requires the server to reboot and access to the BIOS settings.




              2. Through the command line (no need to reboot)




                • You could disable each virtual core in Linux directly, create a disablevcore.sh file:




                  #!/bin/bash
              for i in {YY..YY}; do
              echo "Disabling logical HT core $i."
              echo 0 > /sys/devices/system/cpu/cpu${i}/online;
              done


              And replace YY..YY for the threads ID you want to disable, according to your processors, probably {6..11}. Although I'm not sure how the numbering works on multi-socket setups, so you should check carefully.





              1. Another option (2.a if you will) is to disable it in GRUB:




                • Edit the GRUB config file: /etc/sysconfig/grub (if and append noht in the line that starts with: GRUB_CMDLINE_LINUX. It should be something like this:




              GRUB_CMDLINE_LINUX="... noht ..."




              More about HT and SMT:



              Intel "Hyper-Threading"




              Hyper-threading is Intel's proprietary simultaneous multithreading
              implementation used to improve parallelization of computations
              performed on x86 microprocessors. It first appeared in February 2002
              on Xeon server processors and in November 2002 on Pentium 4 desktop
              CPUs. Later, Intel included this technology in Itanium, Atom, and Core
              'i' Series CPUs, among others.




              https://en.wikipedia.org/wiki/Hyper-threading



              AMD "Simultaneus Multithreading (SMT)"




              Simultaneous multithreading is a technique for improving the overall
              efficiency of superscalar CPUs with hardware multithreading. SMT
              permits multiple independent threads of execution to better utilize
              the resources provided by modern processor architectures.




              https://en.wikipedia.org/wiki/Simultaneous_multithreading



              More details on disabling HT through the kernel:



              https://www.golinuxhub.com/2018/01/how-to-disable-or-enable-hyper.html






              share|improve this answer































                0


















                Virtual Cores or "Threads"



                If you want to avoid virtual cores or "threads", then you could simply disable the feature. Although, disabling this feature not necessarily will improve performance, that depends on the server software you are running (there are engines that work better with HT/SMT, while others don't), you should probably test it.



                According to your post, the Intel X5650 has 6 Cores and 12 Threads each. You can verify this with lscpu. For ex. the following CPU has 4 Cores and the HT disabled:



                $ lscpu
                Architecture: x86_64
                CPU op-mode(s): 32-bit, 64-bit
                Byte Order: Little Endian
                CPU(s): 4
                On-line CPU(s) list: 0-3
                Thread(s) per core: 1
                Core(s) per socket: 4
                Socket(s): 1


                You can verify the HT cores by running:



                # grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list


                This will output something like:



                $  grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list
                /sys/devices/system/cpu/cpu0/topology/thread_siblings_list:X,Y
                /sys/devices/system/cpu/cpu1/topology/thread_siblings_list:X,Y
                /sys/devices/system/cpu/cpu2/topology/thread_siblings_list:X,Y
                /sys/devices/system/cpu/cpu3/topology/thread_siblings_list:X,Y


                Where X,Y are Physical-Core-ID,HT-Core-ID, as in: 0,4 (the first virtual core ID usually is the next to the last physical one).



                Disabling Hyper-Threading



                With this information you have 2 options to disable the HT, depending on your access to the server:





                1. Through the BIOS settings (the easiest)




                  • You should check your Motherboard manufacturer manual, and disable the Hyper-Threading there. This requires the server to reboot and access to the BIOS settings.




                2. Through the command line (no need to reboot)




                  • You could disable each virtual core in Linux directly, create a disablevcore.sh file:




                    #!/bin/bash
                for i in {YY..YY}; do
                echo "Disabling logical HT core $i."
                echo 0 > /sys/devices/system/cpu/cpu${i}/online;
                done


                And replace YY..YY for the threads ID you want to disable, according to your processors, probably {6..11}. Although I'm not sure how the numbering works on multi-socket setups, so you should check carefully.





                1. Another option (2.a if you will) is to disable it in GRUB:




                  • Edit the GRUB config file: /etc/sysconfig/grub (if and append noht in the line that starts with: GRUB_CMDLINE_LINUX. It should be something like this:




                GRUB_CMDLINE_LINUX="... noht ..."




                More about HT and SMT:



                Intel "Hyper-Threading"




                Hyper-threading is Intel's proprietary simultaneous multithreading
                implementation used to improve parallelization of computations
                performed on x86 microprocessors. It first appeared in February 2002
                on Xeon server processors and in November 2002 on Pentium 4 desktop
                CPUs. Later, Intel included this technology in Itanium, Atom, and Core
                'i' Series CPUs, among others.




                https://en.wikipedia.org/wiki/Hyper-threading



                AMD "Simultaneus Multithreading (SMT)"




                Simultaneous multithreading is a technique for improving the overall
                efficiency of superscalar CPUs with hardware multithreading. SMT
                permits multiple independent threads of execution to better utilize
                the resources provided by modern processor architectures.




                https://en.wikipedia.org/wiki/Simultaneous_multithreading



                More details on disabling HT through the kernel:



                https://www.golinuxhub.com/2018/01/how-to-disable-or-enable-hyper.html






                share|improve this answer





























                  0














                  0










                  0









                  Virtual Cores or "Threads"



                  If you want to avoid virtual cores or "threads", then you could simply disable the feature. Although, disabling this feature not necessarily will improve performance, that depends on the server software you are running (there are engines that work better with HT/SMT, while others don't), you should probably test it.



                  According to your post, the Intel X5650 has 6 Cores and 12 Threads each. You can verify this with lscpu. For ex. the following CPU has 4 Cores and the HT disabled:



                  $ lscpu
                  Architecture: x86_64
                  CPU op-mode(s): 32-bit, 64-bit
                  Byte Order: Little Endian
                  CPU(s): 4
                  On-line CPU(s) list: 0-3
                  Thread(s) per core: 1
                  Core(s) per socket: 4
                  Socket(s): 1


                  You can verify the HT cores by running:



                  # grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list


                  This will output something like:



                  $  grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list
                  /sys/devices/system/cpu/cpu0/topology/thread_siblings_list:X,Y
                  /sys/devices/system/cpu/cpu1/topology/thread_siblings_list:X,Y
                  /sys/devices/system/cpu/cpu2/topology/thread_siblings_list:X,Y
                  /sys/devices/system/cpu/cpu3/topology/thread_siblings_list:X,Y


                  Where X,Y are Physical-Core-ID,HT-Core-ID, as in: 0,4 (the first virtual core ID usually is the next to the last physical one).



                  Disabling Hyper-Threading



                  With this information you have 2 options to disable the HT, depending on your access to the server:





                  1. Through the BIOS settings (the easiest)




                    • You should check your Motherboard manufacturer manual, and disable the Hyper-Threading there. This requires the server to reboot and access to the BIOS settings.




                  2. Through the command line (no need to reboot)




                    • You could disable each virtual core in Linux directly, create a disablevcore.sh file:




                      #!/bin/bash
                  for i in {YY..YY}; do
                  echo "Disabling logical HT core $i."
                  echo 0 > /sys/devices/system/cpu/cpu${i}/online;
                  done


                  And replace YY..YY for the threads ID you want to disable, according to your processors, probably {6..11}. Although I'm not sure how the numbering works on multi-socket setups, so you should check carefully.





                  1. Another option (2.a if you will) is to disable it in GRUB:




                    • Edit the GRUB config file: /etc/sysconfig/grub (if and append noht in the line that starts with: GRUB_CMDLINE_LINUX. It should be something like this:




                  GRUB_CMDLINE_LINUX="... noht ..."




                  More about HT and SMT:



                  Intel "Hyper-Threading"




                  Hyper-threading is Intel's proprietary simultaneous multithreading
                  implementation used to improve parallelization of computations
                  performed on x86 microprocessors. It first appeared in February 2002
                  on Xeon server processors and in November 2002 on Pentium 4 desktop
                  CPUs. Later, Intel included this technology in Itanium, Atom, and Core
                  'i' Series CPUs, among others.




                  https://en.wikipedia.org/wiki/Hyper-threading



                  AMD "Simultaneus Multithreading (SMT)"




                  Simultaneous multithreading is a technique for improving the overall
                  efficiency of superscalar CPUs with hardware multithreading. SMT
                  permits multiple independent threads of execution to better utilize
                  the resources provided by modern processor architectures.




                  https://en.wikipedia.org/wiki/Simultaneous_multithreading



                  More details on disabling HT through the kernel:



                  https://www.golinuxhub.com/2018/01/how-to-disable-or-enable-hyper.html






                  share|improve this answer














                  Virtual Cores or "Threads"



                  If you want to avoid virtual cores or "threads", then you could simply disable the feature. Although, disabling this feature not necessarily will improve performance, that depends on the server software you are running (there are engines that work better with HT/SMT, while others don't), you should probably test it.



                  According to your post, the Intel X5650 has 6 Cores and 12 Threads each. You can verify this with lscpu. For ex. the following CPU has 4 Cores and the HT disabled:



                  $ lscpu
                  Architecture: x86_64
                  CPU op-mode(s): 32-bit, 64-bit
                  Byte Order: Little Endian
                  CPU(s): 4
                  On-line CPU(s) list: 0-3
                  Thread(s) per core: 1
                  Core(s) per socket: 4
                  Socket(s): 1


                  You can verify the HT cores by running:



                  # grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list


                  This will output something like:



                  $  grep -H . /sys/devices/system/cpu/cpu*/topology/thread_siblings_list
                  /sys/devices/system/cpu/cpu0/topology/thread_siblings_list:X,Y
                  /sys/devices/system/cpu/cpu1/topology/thread_siblings_list:X,Y
                  /sys/devices/system/cpu/cpu2/topology/thread_siblings_list:X,Y
                  /sys/devices/system/cpu/cpu3/topology/thread_siblings_list:X,Y


                  Where X,Y are Physical-Core-ID,HT-Core-ID, as in: 0,4 (the first virtual core ID usually is the next to the last physical one).



                  Disabling Hyper-Threading



                  With this information you have 2 options to disable the HT, depending on your access to the server:





                  1. Through the BIOS settings (the easiest)




                    • You should check your Motherboard manufacturer manual, and disable the Hyper-Threading there. This requires the server to reboot and access to the BIOS settings.




                  2. Through the command line (no need to reboot)




                    • You could disable each virtual core in Linux directly, create a disablevcore.sh file:




                      #!/bin/bash
                  for i in {YY..YY}; do
                  echo "Disabling logical HT core $i."
                  echo 0 > /sys/devices/system/cpu/cpu${i}/online;
                  done


                  And replace YY..YY for the threads ID you want to disable, according to your processors, probably {6..11}. Although I'm not sure how the numbering works on multi-socket setups, so you should check carefully.





                  1. Another option (2.a if you will) is to disable it in GRUB:




                    • Edit the GRUB config file: /etc/sysconfig/grub (if and append noht in the line that starts with: GRUB_CMDLINE_LINUX. It should be something like this:




                  GRUB_CMDLINE_LINUX="... noht ..."




                  More about HT and SMT:



                  Intel "Hyper-Threading"




                  Hyper-threading is Intel's proprietary simultaneous multithreading
                  implementation used to improve parallelization of computations
                  performed on x86 microprocessors. It first appeared in February 2002
                  on Xeon server processors and in November 2002 on Pentium 4 desktop
                  CPUs. Later, Intel included this technology in Itanium, Atom, and Core
                  'i' Series CPUs, among others.




                  https://en.wikipedia.org/wiki/Hyper-threading



                  AMD "Simultaneus Multithreading (SMT)"




                  Simultaneous multithreading is a technique for improving the overall
                  efficiency of superscalar CPUs with hardware multithreading. SMT
                  permits multiple independent threads of execution to better utilize
                  the resources provided by modern processor architectures.




                  https://en.wikipedia.org/wiki/Simultaneous_multithreading



                  More details on disabling HT through the kernel:



                  https://www.golinuxhub.com/2018/01/how-to-disable-or-enable-hyper.html







                  share|improve this answer













                  share|improve this answer




                  share|improve this answer



                  share|improve this answer










                  answered 38 mins ago









                  LeoLeo

                  2312 silver badges5 bronze badges




                  2312 silver badges5 bronze badges


































                      draft saved

                      draft discarded



















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f427068%2fcan-i-tell-my-linux-machine-use-only-physical-cores%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown









                      Popular posts from this blog

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...