• Will Deacon's avatar
    sched: Allow task CPU affinity to be restricted on asymmetric systems · 07ec77a1
    Will Deacon authored
    Asymmetric systems may not offer the same level of userspace ISA support
    across all CPUs, meaning that some applications cannot be executed by
    some CPUs. As a concrete example, upcoming arm64 big.LITTLE designs do
    not feature support for 32-bit applications on both clusters.
    
    Although userspace can carefully manage the affinity masks for such
    tasks, one place where it is particularly problematic is execve()
    because the CPU on which the execve() is occurring may be incompatible
    with the new application image. In such a situation, it is desirable to
    restrict the affinity mask of the task and ensure that the new image is
    entered on a compatible CPU. From userspace's point of view, this looks
    the same as if the incompatible CPUs have been hotplugged off in the
    task's affinity mask. Similarly, if a subsequent execve() reverts to
    a compatible image, then the old affinity is restored if it is still
    valid.
    
    In preparation for restricting the affinity mask for compat tasks on
    arm64 systems without uniform support for 32-bit applications, introduce
    {force,relax}_compatible_cpus_allowed_ptr(), which respectively restrict
    and restore the affinity mask for a task based on the compatible CPUs.
    Signed-off-by: default avatarWill Deacon <will@kernel.org>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: default avatarValentin Schneider <valentin.schneider@arm.com>
    Reviewed-by: default avatarQuentin Perret <qperret@google.com>
    Link: https://lore.kernel.org/r/20210730112443.23245-9-will@kernel.org
    07ec77a1
core.c 268 KB