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_layered: Add MATCH_NICE_EQUALS match kind #149

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

davemarchevsky
Copy link
Contributor

I have a usecase where specific nice values are used to bucket tasks into groups that are handled separately by different scx_layered policies, with no implications of relative priority between niceness X, X + 1, X - 1, etc. In other words, nicevals are used as simple tags in this scenario.

If we wanted to treat a specific niceness this way e.g. 11, we could do so with AND'd MATCH_NICE_{ABOVE,BELOW} like so:

  "matches" : [
    [
      {
        "NiceAbove": 10
      },
      {
        "NiceBelow": 12
      },
    ],
  ],

But this is unnecessarily verbose and doesn't communicate the intent of the match very well. Adding a NiceEquals matcher simplifies the config and makes intent obvious:

  "matches" : [
    [
      {
        "NiceEquals": 11
      },
    ],
  ],

This PR adds support for such a matcher.

Also, rename layer_match.nice_above_or_below to just layer_match.nice, as the former doesn't describe the newly-added matcher's use of the field. It's still obvious that layer_match.nice is relevant to MATCH_NICE_{ABOVE, BELOW, EQUALS}.

@davemarchevsky davemarchevsky force-pushed the davemarchevsky_nice_equals branch from 2afce45 to 7060393 Compare February 22, 2024 10:57
I have a usecase where specific nice values are used to bucket tasks
into groups that are handled separately by different `scx_layered`
policies, with no implications of relative priority between niceness X,
X + 1, X - 1, etc. In other words, nicevals are used as simple tags in
this scenario.

If we wanted to treat a specific niceness this way e.g. `11`, we could
do so with AND'd MATCH_NICE_{ABOVE,BELOW} like so:

```json
  "matches" : [
    [
      {
        "NiceAbove": 10
      },
      {
        "NiceBelow": 12
      },
    ],
  ],
```

But this is unnecessarily verbose and doesn't communicate the intent of
the match very well. Adding a `NiceEquals` matcher simplifies the
config and makes intent obvious:

```json
  "matches" : [
    [
      {
        "NiceEquals": 11
      },
    ],
  ],
```

This PR adds support for such a matcher.

Also, rename `layer_match.nice_above_or_below` to just
`layer_match.nice`, as the former doesn't describe the newly-added
matcher's use of the field. It's still obvious that `layer_match.nice`
is relevant to MATCH_NICE_{ABOVE, BELOW, EQUALS}.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
@davemarchevsky davemarchevsky force-pushed the davemarchevsky_nice_equals branch from 7060393 to 9f510f1 Compare February 22, 2024 12:08
@htejun htejun merged commit 4dc77f8 into sched-ext:main Feb 22, 2024
1 check passed
@davemarchevsky davemarchevsky deleted the davemarchevsky_nice_equals branch February 22, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants