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

scx: Exit a scheduler for unhandled hotplug events #177

Merged
merged 4 commits into from
Apr 10, 2024
Merged

Commits on Apr 8, 2024

  1. scx: Add scx_ops_exit() macro for exiting from ext.c

    We currently provide scx_ops_error() as a way for ext.c to cause a
    scheduler to be evicted due to erroneous behavior (for example, due to
    returning an invalid CPU from ops.select_cpu()). Now that we have a
    method for exiting gracefully with an exit code from BPF programs, we
    can similarly provide an scx_ops_exit() macro that allows ext.c to exit
    and pipe an exit code up to user space.
    
    This patch adds that macro. A subsequent patch will use it to exit and
    plumb up hotplug events.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    0213f1b View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2024

  1. scx: Exit a scheduler for unhandled hotplug events

    A scheduler may implement ops.cpu_online() and ops.cpu_offline() for CPU
    onlining and offlining events respectively. If a scheduler does _not_
    implement these callbacks, it's indicative that they do not support
    hotplug. Given that a scheduler that doesn't support hotplug is
    essentially guaranteed to perform incorrectly if a hotplug event occurs,
    let's update ext.c to do the sane thing, and exit the scheduler
    automatically.
    
    Given that there may be other events in the future that could cause the
    scheduler to initiate an exit, we create a new enum scx_exit_code type
    that reserves the top bit of the exit_code field in struct
    scx_exit_info, and defines SCX_ECODE_RESTART. We could as an alternative
    instead just return something like -EAGAIN to signify that user space
    can try restarting the scheduler.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Apr 10, 2024
    Configuration menu
    Copy the full SHA
    e41cbfa View commit details
    Browse the repository at this point in the history
  2. scx: Add more user_exit_info macros for exit code

    Now that we have bits reserved for system exit code reasons and actions,
    as well as bits available for user by user space, let's add some
    ease-of-use macro to user_exit_info.h. A subsequent patch will add
    selftests that use these macros.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Apr 10, 2024
    Configuration menu
    Copy the full SHA
    e298904 View commit details
    Browse the repository at this point in the history
  3. scx: Add selftests for hotplug operations

    We've recently added some logic related to hotplug:
    
    - If a hotplug event occurs and a scheduler hasn't implemented a
      callback for it, we automatically exit the scheduler with specific,
      built-in exit codes
    
    - With scx_bpf_exit(), a scheduler can choose to manually exit the
      scheduler in a hotplug event, or do something else. In any case, the
      scheduler should _not_ be automatically exited by the kernel
    
    Let's add selftests to validate these conditions.
    
    Signed-off-by: David Vernet <[email protected]>
    Byte-Lab committed Apr 10, 2024
    Configuration menu
    Copy the full SHA
    e77fa31 View commit details
    Browse the repository at this point in the history