Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Allow clean exits from the scheduler with scx_bpf_exit() #166

Merged
merged 4 commits into from
Mar 28, 2024

Commits on Mar 28, 2024

  1. scx: Allow clean exits from the scheduler with scx_bpf_exit()

    There may be cases where a scheduler wants to cause itself to exit under
    normal circumstances. For example, if a scheduler does not support
    hotplug, it may want to exit to user space if a CPU is hotplugged or
    unplugged to let it know that it should restart itself.
    
    To enable this, we implement a new kfunc called scx_bpf_exit_bstr().
    This kfunc shares a good amount of logic with scx_bpf_error_bstr(), as
    both of them can plumb an exit message from BPF to user space. In
    addition, we also augment struct scx_exit_info to include an exit code
    field.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    11ed27f View commit details
    Browse the repository at this point in the history
  2. scx: Add scx_bpf_exit() macro to scx/common.bpf.h

    As with scx_bpf_error(), we want schedulers to have an ergonomic API for
    exiting execution. Let's add an scx_bpf_exit() macro wrapper that does
    nearly the same thing as scx_bpf_error(), but invokes
    scx_bpf_exit_bstr() instead of scx_bpf_error_bstr().
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    e831248 View commit details
    Browse the repository at this point in the history
  3. scx: Fix init_enable_count

    We no longer have scx_bpf_switch_all(). Let's update the test to use
    __COMPAT_SCX_OPS_SWITCH_PARTIAL. Along the way, make it less flaky.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    a0b24e0 View commit details
    Browse the repository at this point in the history
  4. scx: Add selftests for scx_bpf_exit()

    Let's add a selftest that verifies us using scx_bpf_exit() to exit from
    various callbacks in the program.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    14162f7 View commit details
    Browse the repository at this point in the history