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_bpfland: introduce dynamic nvcsw threshold #439

Merged
merged 1 commit into from
Jul 18, 2024

Commits on Jul 18, 2024

  1. scx_bpfland: introduce dynamic nvcsw threshold

    Instead of using a static value to classify tasks based on their average
    amount of voluntary context switches, try to periodically evaluate an
    optimal threshold, based on a global average of voluntary context
    switches among of all the running tasks.
    
    Tasks with an average amount of voluntary context switches greater than
    the global average will be classified as interactive.
    
    The global average is evaluated as an exponentially weighted moving
    average (EWMA), as:
    
      avg(t) = avg(t - 1) * 0.75 - task_avg(t) * 0.25
    
    This approach is more efficient than iterating through all tasks and it
    helps to prevent rapid fluctuations that may be caused by bursts of
    voluntary context switch events.
    
    The dynamic nvcsw threshold enables a more precise adjustment of
    the classification criteria to swiftly respond to global system changes:
    tasks can be quickly classified as interactive, but if the system
    experiences too many interactive events, the criteria for maintaining
    interactive status become stricter. This creates a natural selection
    process where only the most deserving tasks remain interactive.
    
    Additionally, introduce the new option `--nvcsw-max-thresh N`, which
    allows to extend or restrict the fluctuation range of the global average
    threshold for voluntary context switches.
    
    Tested-by: Piotr Gorski <[email protected]>
    Signed-off-by: Andrea Righi <[email protected]>
    arighi committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    c4eb3ce View commit details
    Browse the repository at this point in the history