User: Password:
|
|
Subscribe / Log in / New account

Group scheduling

Group scheduling

Posted Oct 18, 2007 9:45 UTC (Thu) by mingo (subscriber, #31122)
Parent article: Merged for 2.6.24

The CFS group scheduling code has been merged. There is also a mechanism for per-UID group scheduling. As of this writing, though, the feature cannot actually be turned on because the control groups code has not yet been merged.

Small correction: it can already be turned on via the CONFIG_FAIR_GROUP_SCHED=y config option - this is a feature that has been added recently.

With this feature enabled the kernel will schedule based on UIDs too: if one user runs 500 tasks and the other user runs only 2 tasks, the two users will still share the CPU(s) fairly, with both getting 50% of CPU time. (I have also tested this with fork bombs: if a user is running a fork bomb then other users are not affected at all [CPU scheduling wise], and the admin can log in and disable the user as well.)

The scheduling weight of each UID defaults to 100%, and it can be dynamically reconfigured via sysfs: /sys/kernel/uid/*/cpu_share - a value of 1024 means 100% weight. So by echoing 2048 into that file a user will get twice as much CPU time as a user who has 1024 cpu_share value.

An additional mechanism is that uevents can be used to configure UIDs as they get created. None of this needs the control groups / containers APIs.


(Log in to post comments)

Group scheduling

Posted Oct 18, 2007 11:36 UTC (Thu) by mingo (subscriber, #31122) [Link]

/sys/kernel/uid/*/cpu_share

Correcting myself: the right path is /sys/kernel/uids/*/cpu_share

Group scheduling

Posted Oct 18, 2007 11:56 UTC (Thu) by paravoid (subscriber, #32869) [Link]

While this sounds interesting, I wonder what it's implications going to be on systems that
have not designed with that in mind.

e.g. a random process run by a user getting 50% while N processes of apache take the other
50%...

Group scheduling

Posted Oct 18, 2007 15:33 UTC (Thu) by mingo (subscriber, #31122) [Link]

yes - anything that changes previous behavior can be "bad" for someone who expects exactly the same behavior as before.

that's why there is a config option for it that can be turned on or off. (and that's why the exact weight is configurable - often the benefits heavily outweigh the changed behavior and it's better to just adjust the defaults a bit - by for example giving the httpd user a higher weight.)

Group scheduling

Posted Oct 18, 2007 12:51 UTC (Thu) by corbet (editor, #1) [Link]

It's the per-UID scheduling which can be turned on now, right? When I added that sentence I obviously didn't take a proper look at how the paragraph reads as a whole...

Group scheduling

Posted Oct 18, 2007 15:30 UTC (Thu) by mingo (subscriber, #31122) [Link]

It's the per-UID scheduling which can be turned on now, right?

yeah.

When I added that sentence I obviously didn't take a proper look at how the paragraph reads as a whole...

Indeed - and you describe it all in more detail in the larger article about group scheduling. But i only saw that after writing this comment :-/


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds