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 user and group layers #447

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

hodgesds
Copy link
Contributor

@hodgesds hodgesds commented Jul 24, 2024

Add a layer match based on either the effective user id or the effective group id. This allows for creating layers for individual users or groups.

Test:

$ id
uid=224791(hodgesd) gid=100(users) groups=100(users)

config:

$ cat user.json 
[{
  "name":"hodgesd",
  "comment":"hodgesd user",
  "matches":[
     [{"UIDEquals":224791}]
  ],
  "kind": {
    "Open":{
      "min_exec_us":0,
      "preempt": true,
      "exclusive": true
     }
  }
},
{
  "name":"normal",
  "comment":"the rest",
  "matches":[[]],
  "kind":{
    "Open": {
      "min_exec_us":0,
      "preempt":false,
      "exclusive":false
    }
  }
}]

scx_layered has layers for my user:

18:56:35 [INFO] excl_coll= 0.00 excl_preempt= 0.00 excl_idle= 0.00 excl_wakeup= 0.02
18:56:35 [INFO]   hodgesd: util/frac=    9.8/  5.5 load/frac=      9.6:  3.2 tasks=   355
18:56:35 [INFO]            tot=    621 local=94.85 wake/exp/last/reenq= 3.70/ 0.48/ 0.97/ 0.00
18:56:35 [INFO]            keep/max/busy= 0.97/ 0.00/ 0.00 kick= 0.48 yield/ign= 0.00/    0 
18:56:35 [INFO]            open_idle= 0.00 mig=17.23 affn_viol= 0.00
18:56:35 [INFO]            preempt/first/idle/fail= 0.16/ 0.00/ 3.54/ 0.00 min_exec= 0.00/   0.00ms
18:56:35 [INFO]            cpus=  0 [  0,  0] 00000000 00000000 00000000
18:56:35 [INFO]            excl_coll= 0.00 excl_preempt= 0.00
18:56:35 [INFO]   normal : util/frac=  167.2/ 94.5 load/frac=    288.6: 96.8 tasks=  3203
18:56:35 [INFO]            tot=  26836 local=95.83 wake/exp/last/reenq= 1.79/ 0.56/ 1.82/ 0.01
18:56:35 [INFO]            keep/max/busy= 0.28/ 0.00/ 0.00 kick= 0.57 yield/ign= 1.56/    0 
18:56:35 [INFO]            open_idle= 0.00 mig= 6.58 affn_viol= 0.00
18:56:35 [INFO]            preempt/first/idle/fail= 0.00/ 0.00/ 0.00/ 0.00 min_exec= 0.00/   0.00ms
18:56:35 [INFO]            cpus=  0 [  0,  0] 00000000 00000000 00000000

@hodgesds hodgesds requested a review from htejun July 24, 2024 18:57
@@ -123,6 +123,10 @@ lazy_static::lazy_static! {
/// - NiceEquals: Matches if the task's nice value is exactly equal to
/// the pattern.
///
/// - UserId: Matches if the task's effective user id matches the pattern.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be UserIdEquals?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess so. If it were me, I'd just do UIDEquls and GIDEquals but either way is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's better, let me update.

Add a layer match based on either the effective user id or the effective
group id. This allows for creating layers for individual users or
groups.

Signed-off-by: Daniel Hodges <[email protected]>
TLDR; rename UserId and GroupId to UIDEquals and GIDEquals.

Signed-off-by: Daniel Hodges <[email protected]>
@hodgesds hodgesds merged commit 427eed6 into sched-ext:main Jul 24, 2024
1 check passed
@hodgesds hodgesds deleted the layered-user-group branch July 24, 2024 22:47
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.

2 participants