lkml.org 
[lkml]   [2023]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/2] cpuset: Call set_cpus_allowed_ptr() with appropriate mask for task
    On Tue, Jan 31, 2023 at 10:17:19PM +0000, Will Deacon wrote:
    > set_cpus_allowed_ptr() will fail with -EINVAL if the requested
    > affinity mask is not a subset of the task_cpu_possible_mask() for the
    > task being updated. Consequently, on a heterogeneous system with cpusets
    > spanning the different CPU types, updates to the cgroup hierarchy can
    > silently fail to update task affinities when the effective affinity
    > mask for the cpuset is expanded.
    >
    > For example, consider an arm64 system with 4 CPUs, where CPUs 2-3 are
    > the only cores capable of executing 32-bit tasks. Attaching a 32-bit
    > task to a cpuset containing CPUs 0-2 will correctly affine the task to
    > CPU 2. Extending the cpuset to CPUs 0-3, however, will fail to extend
    > the affinity mask of the 32-bit task because update_tasks_cpumask() will
    > pass the full 0-3 mask to set_cpus_allowed_ptr().
    >
    > Extend update_tasks_cpumask() to take a temporary 'cpumask' paramater
    > and use it to mask the 'effective_cpus' mask with the possible mask for
    > each task being updated.
    >
    > Fixes: 431c69fac05b ("cpuset: Honour task_cpu_possible_mask() in guarantee_online_cpus()")
    > Signed-off-by: Will Deacon <will@kernel.org>
    > ---
    >
    > Note: We wondered whether it was worth calling guarantee_online_cpus()
    > if the cpumask_and() returns 0 in update_tasks_cpumask(), but given that
    > this path is only called when the effective mask changes, it didn't
    > seem appropriate. Ultimately, if you have 32-bit tasks attached to a
    > cpuset containing only 64-bit cpus, then the affinity is going to be
    > forced.

    Right, so the case above where the cpuset is shrunk to 0-1, then the
    intersection between the cpuset and task_cpu_possible_mask() is empty
    and it currently simply fails to update mask.

    I argued it was probably desired to walk up the tree to find a wider
    parent until the intersection of {cpuset, task_cpu_possible_mask,
    online} becomes non-empty.

    But I suppose that can wait until we have more time.

    \
     
     \ /
      Last update: 2023-03-27 00:04    [W:4.032 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site