-
Notifications
You must be signed in to change notification settings - Fork 144
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
add new generate options for setting cpu/mem #175
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,45 @@ read the configuration from `config.json`. | |
**--label**=[] | ||
Add annotations to the configuration e.g. key=value. | ||
|
||
**--linux-cpu-shares**=CPUSHARES | ||
Specifies a relative share of CPU time available to the tasks in a cgroup. | ||
|
||
**--linux-cpu-period**=CPUPERIOD | ||
Specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only). | ||
|
||
**--linux-cpu-quota**=CPUQUOTA | ||
Specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period. | ||
|
||
**--linux-realtime-runtime**=REALTIMERUNTIME | ||
Specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources. | ||
|
||
**--linux-realtime-period**=REALTIMEPERIOD | ||
Sets the CPU period to be used for realtime scheduling (in usecs). Same as **--linux-cpu-period** but applies to realtime scheduler only. | ||
|
||
**--linux-cpus**=CPUS | ||
Sets the CPUs to use within the cpuset (default is to use any CPU available). | ||
|
||
**--linux-mems**=MEMS | ||
Sets the list of memory nodes in the cpuset (default is to use any available memory node). | ||
|
||
**--linux-mem-limit**=MEMLIMIT | ||
Sets the limit of memory usage in bytes. | ||
|
||
**--linux-mem-reservation**=MEMRESERVATION | ||
Sets the soft limit of memory usage in bytes. | ||
|
||
**--linux-mem-swap**=MEMSWAP | ||
Sets the total memory limit (memory + swap) in bytes. | ||
|
||
**--linux-mem-kernel-limit**=MEMKERNELLIMIT | ||
Sets the hard limit of kernel memory in bytes. | ||
|
||
**--linux-mem-kernel-tcp**=MEMKERNELTCP | ||
Sets the hard limit of kernel TCP buffer memory in bytes. | ||
|
||
**--linux-mem-swappiness**=MEMSWAPPINESS | ||
Sets the swappiness of how the kernel will swap memory pages (Range from 0 to 100). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're going to specify a range here, we probably want code in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wking , good points. In fact, there are several other fields having ranges we can enforce in the generate library. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Fri, Aug 05, 2016 at 10:49:39AM -0700, hmeng-19 wrote:
Filed as #186. |
||
|
||
**--mount**=*PATH* | ||
Use a mount namespace where *PATH* is an existing mount namespace file | ||
to join. The special *PATH* empty-string creates a new namespace. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“CFS only” seems like we want a
--host-specific
guard to error out if someone tries to set it with--host-specific
when they aren't using a CFS scheduler. But after reading over sched(7) and sched_setscheduler(2), I'm not quite sure how to do that. It looks like you check for aSCHED_OTHER
policy
, butsched_getscheduler
is per-thread. Is the scheduler policy really set on a per-thread basis? Is a host-specific check just supposed to look for internal consistency (e.g. the config doesn't set both a CFS-only and a realtime-only parameter)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking , I think there are two ways we can use to determine the current scheduler.
cpu.cfs_period_us
exists or not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Fri, Aug 05, 2016 at 11:58:48AM -0700, hmeng-19 wrote:
These both sound like “does your kernel support that scheduler”, but
if scheduler policy is per-thread, then how do you know the container
will use that available scheduler (and not another available
scheduler)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking , @mrunalp , do correct me if I am wrong.
I always thought the scheduling policy is a system-level config. It is decided when you built your kernel. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Fri, Aug 05, 2016 at 08:25:27PM -0700, hmeng-19 wrote:
That was my impression before poking around in the man pages today.
But see also 1, which has:
Each process or thread is controlled by an associated scheduling
policy and priority…
And 2 has:
If at least one RT task is running, no other SCHED_OTHER task will
be allowed to run in any CPU.
which makes it fairly clear that you can have threads/processes with
different schedulers running concurrently. I'm not sure how that
works for the cgroup settings though. Maybe you can set them all
(both real-time and CFS parameters) and the kernel will apply the
appropriate limits to each task depending on its policy? In that
case, configs that specify settings for multiple schedulers are fair
game.