Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scx_rustland fixes and improvements #804

Merged
merged 12 commits into from
Oct 16, 2024
Merged

scx_rustland fixes and improvements #804

merged 12 commits into from
Oct 16, 2024

Commits on Oct 15, 2024

  1. scx_rustland_core: update CPU idle selection logic

    Re-align idle selection logic with some of the latest improvements done
    in scx_bpfland.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    1bbae64 View commit details
    Browse the repository at this point in the history
  2. scx_rustland_core: pass nvcsw, slice and dsq_vtime to user-space

    Provide additional task metrics to user-space schedulers via QueuedTask:
     - nvcsw: total amount of voluntary context switches
     - slice: task time slice "budget" (from p->scx.slice)
     - dsq_vtime: current task vtime (from p->scx.dsq_vtime)
    
    In this way user-space schedulers can quickly access these metrics to
    implement better scheduling policy.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    be681c7 View commit details
    Browse the repository at this point in the history
  3. scx_rustland_core: allow user-space scheduler to run indefinitely

    Assign an infinite time slice to the user-space scheduler itself, so
    that it can completely drain all the pending tasks and voluntarily
    release the CPU when it's done.
    
    This allows to achieve more consistent performance and we can also
    remove the speculative user-space scheduler wakeup from ops.stopping().
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    4432e64 View commit details
    Browse the repository at this point in the history
  4. scx_rustland_core: restart scheduler on hotplug events

    User-space schedulers may still hit some stalls during CPU hotplugging
    events.
    
    There is no reason to overcomplicate the code and trying to handle
    hotplug events within the scx_rustland_core framework and we can simply
    handle a scheduler restart performed by the scx core.
    
    This makes CPU hotplugging more reliable with scx_rustland_core-based
    schedulers.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    abfb4c5 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2024

  1. scx_rustland_core: keep CPUs alive with pending tasks

    Prevent CPUs from going idle when the user-space scheduler has some
    pending activities to complete.
    
    Keeping the CPU alive allows to consume tasks from the user-space
    scheduler more efficiently, preventing bubbles in the scheduling
    pipeline.
    
    To achieve this, trigger a CPU kick from ops.update_idle() and set a
    flag in the CPU context to prevent it from going idle. Then keep kicking
    the CPU from ops.dispatch() until the flag is cleared, which occurs when
    no more tasks are pending or when the CPU exits idle as a task starts
    running on it.
    
    This allows to fix the performance regression introduced by the
    put_prev_task_scx() behavior change in Linux 6.12 (see #788).
    
    Link: https://lore.kernel.org/lkml/[email protected]/
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    0a05f1f View commit details
    Browse the repository at this point in the history
  2. scx_rustland_core: kick an idle CPU after global dispatch

    Do not kick a CPU from rs_select_cpu() (called by the user-space
    scheduler), since we may not immediately dispatch the task.
    
    Instead, always try to wake up the task's assigned CPU after dispatching
    to a global DSQ, ensuring it can be consumed immediately.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    67ec1af View commit details
    Browse the repository at this point in the history
  3. scx_rustland_core: get rid of the SCX_ENQ_WAKEUP logic

    With user-space scheduling we don't usually dispatch a task immediately
    after selecting an idle CPU, so there's not much benefit at trying to
    optimize the WAKE_SYNC scenario (when a task is waking up another task
    and releaing the CPU) when picking an idle CPU.
    
    Therefore, get rid of the WAKE_SYNC logic in select_cpu() and rely on
    the user-space logic (that has access to the WAKE_SYNC information) to
    handle this particular case.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    704fe95 View commit details
    Browse the repository at this point in the history
  4. scx_rustland_core: bump up version to 2.2.2

    Bump up the minor version to reflect the new backward-compatible
    functionality added.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    9762917 View commit details
    Browse the repository at this point in the history
  5. scx_rustland: use built-in nvcsw metrics

    Use the nvcsw metric from the scx_rustland_core backend, intead of
    retrieving this metric in user-space via procfs.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    0b2de2c View commit details
    Browse the repository at this point in the history
  6. scx_rustland: smooth vruntime update

    Update vruntime adding the used virtual time slice of each task as soon
    they are scheduled.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    c4b6408 View commit details
    Browse the repository at this point in the history
  7. scx_rustland: clarify EDF scheduling

    scx_rustland is now effectively a deadline-based scheduler and not a
    pure vruntime-based scheduler.
    
    Clarify this in the source code. No functional change.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    b07de1d View commit details
    Browse the repository at this point in the history
  8. scx_rlfifo: operate in a more work-conserving way

    Make scx_rlfifo even simpler and keep dispatching tasks even if the CPUs
    are all busy.
    
    This allows to better stress test the scx_rustland_core backend, by
    using both the per-CPU DSQs and the global shared DSQ.
    
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    763da6a View commit details
    Browse the repository at this point in the history