How do I restrict the number of CPUs used by Linux on a multicore CPS?

Tagged: ,

This topic contains 1 reply, has 1 voice, and was last updated by  ChrisImgtec 3 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #31561

    ChrisImgtec
    Moderator

    You can restrict the number of CPUs used by Linux with the
    isolcpus boot option:

    Name
    isolcpus – isolate CPUs from the kernel scheduler.

    Synopsis
    isolcpus= cpu_number [, cpu_number ,…]

    Description
    Remove the specified CPUs, as defined by the cpu_number
    values, from the general kernel SMP balancing and scheduler
    algroithms. The only way to move a process onto or off an
    “isolated” CPU is via the CPU affinity syscalls. cpu_number
    begins at 0, so the maximum value is 1 less than the number
    of CPUs on the system.

    This option is the preferred way to isolate CPUs. The
    alternative–manually setting the CPU mask of all tasks in
    the system–can cause problems and suboptimal load balancer
    performance.

    So for a Mulit threaded 3-core (6-CPU) CPS, if you want to restrict
    the number of cores to 1, you would add the following to
    your boot command:

    isolcpus=2,3,4,5

    And if you want to restrict the number of cores to 2:

    isolcpus=4,5

    To restrict the number of VPEs per core to 1:

    isolcpus=1,3,5

    Here is the output of ‘mpstat -P ALL’ after I boot my 3 core
    1004K Malta with isolcpus=1,3,5:

    -sh-4.1# mpstat -P ALL
    Linux 2.6.32-ts-mipsisa32r2cmp (malta_le_hf) 05/11/11 _mips_ (6 CPU)

    10:29:51 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %idle
    10:29:51 all 3.19 0.00 3.05 0.12 0.03 0.01 0.00 0.00 93.60
    10:29:51 0 7.62 0.00 12.57 0.25 0.17 0.02 0.00 0.00 79.37
    10:29:51 1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
    10:29:51 2 6.80 0.00 3.43 0.27 0.00 0.01 0.00 0.00 89.49
    10:29:51 3 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
    10:29:51 4 4.74 0.00 2.28 0.20 0.00 0.01 0.00 0.00 92.77
    10:29:51 5 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 100.00
    -sh-4.1#

    As you can see, CPUs 1, 3, and 5 are 100% idle because they
    are isolated from the kernel scheduler.

    #38251

    ChrisImgtec
    Moderator

    Imagination MIPS Support

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.