The latest development version of this page may be more current than this released 1.14.0 version.
CONFIG_SCHED_CPU_MASK

Enable CPU mask affinity/pinning API

Type: bool

Help

When true, the app will have access to the z_thread_*_cpu_mask() APIs which control per-CPU affinity masks in SMP mode, allowing apps to pin threads to specific CPUs or disallow threads from running on given CPUs. Note that as currently implemented, this involves an inherent O(N) scaling in the number of idle-but-runnable threads, and thus works only with the DUMB scheduler (as SCALABLE and MULTIQ would see no benefit).

Note that this setting does not technically depend on SMP and is implemented without it for testing purposes, but for obvious reasons makes sense as an application API only where there is more than one CPU. With one CPU, it’s just a higher overhead version of k_thread_start/stop().

Direct dependencies

SCHED_DUMB

(Includes any dependencies from if’s and menus.)

Defaults

No defaults. Implicitly defaults to n.

Kconfig definition

At kernel/Kconfig:129

Included via Kconfig:10Kconfig.zephyr:31

Menu path: (top menu) → General Kernel Options

config SCHED_CPU_MASK
    bool
    prompt "Enable CPU mask affinity/pinning API" if SCHED_DUMB
    depends on SCHED_DUMB
    help
      When true, the app will have access to the
      z_thread_*_cpu_mask() APIs which control per-CPU affinity
      masks in SMP mode, allowing apps to pin threads to specific
      CPUs or disallow threads from running on given CPUs.  Note
      that as currently implemented, this involves an inherent
      O(N) scaling in the number of idle-but-runnable threads, and
      thus works only with the DUMB scheduler (as SCALABLE and
      MULTIQ would see no benefit).

      Note that this setting does not technically depend on SMP
      and is implemented without it for testing purposes, but for
      obvious reasons makes sense as an application API only where
      there is more than one CPU.  With one CPU, it's just a
      higher overhead version of k_thread_start/stop().

(Definitions include propagated dependencies, including from if’s and menus.)