linux 隔离CPU内核(物理还是逻辑?)

pxq42qpu  于 2023-02-03  发布在  Linux
关注(0)|答案(2)|浏览(195)

内核参数'isolcpus'接受物理核心ID,我的想法对吗?因此,如果我有4个物理核心,并启用了超线程,这给我总共8个核心,那么我只允许在isolcpus参数中指定cpu核心1..3(core0代表操作系统)?
谢谢。

sirbozc5

sirbozc51#

红帽大师Daniel Macphersona Red Hat community discussion中说:
因此,您可能需要限制内核访问已固定到示例的CPU。例如,假设我有一个具有双超线程的8核CPU,这将产生16个vcpu。我希望将核心0用于OpenStack服务,将核心1-7用于示例。我需要告诉内核不要使用这些核心。这意味着我“d需要告诉内核不要管vcpu 1-7和9-15:

$ sudo grubby --update-kernel=ALL --args="isolcpus=1,2,3,4,5,6,7,9,10,11,12,13,14,15"
$ sudo grub2-install /dev/sda
$ sudo reboot

据此,可以为isolcpus内核参数指定logical CPU cores

wtzytmuj

wtzytmuj2#

是开源的。
Documentation/kernel-parameters.txt

isolcpus=   [KNL,SMP] Isolate CPUs from the general scheduler.
        Format:
        <cpu number>,...,<cpu number>
        or
        <cpu number>-<cpu number>
        (must be a positive range in ascending order)
        or a mixture
        <cpu number>,...,<cpu number>-<cpu number>

        This option can be used to specify one or more CPUs
        to isolate from the general SMP balancing and scheduling
        algorithms. You can move a process onto or off an
        "isolated" CPU via the CPU affinity syscalls or cpuset.
        <cpu number> begins at 0 and the maximum value is
        "number of CPUs in system - 1".

        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.

如果这还不够,只需搜索isolcplus的源代码并查看如何使用。

相关问题