Editing
Applying CPU Limits
From Linix VServer
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Applying CPU limits = This is a short summary on how to apply limits. This doesn't cover how to choose the values but just on how to apply the numbers in a running vserver without saving the configuration. note: you can find soft/hard cpu limit with cgroups for vserver2.3 on [[util-vserver:Cgroups]] == Kernel config == First check whether the kernel is with '''CONFIG_VSERVER_HARDCPU''' enabled: # cat /boot/config-blah | grep CONFIG_VSERVER_HARDCPU CONFIG_VSERVER_HARDCPU=y Note: With newer kernels, the config of the currently running kernel can be found with `zcat /proc/config.gz | grep VSERVER`. == Context flag == Then check if the vserver you want to apply limits has the [http://linux-vserver.org/Capabilities_and_Flags#Context_flags_.28cflags.29 sched_hard] context flag enabled by checking the contents of ''/proc/virtual/<xid>/status''. The sched_hard flag is ''0x00000100'', so you have to find this value summed up in the vserver flag (see [http://www.mail-archive.com/vserver@list.linux-vserver.org/msg10448.html this message] for details). If its not enabled, use the following command (more info [http://www.mail-archive.com/vserver@list.linux-vserver.org/msg08385.html here]): vattribute --set --xid <xid> --flag sched_hard == Setting the limits == Then you should be able to set the limits with a command like this one (more info [http://oldwiki.linux-vserver.org/vsched+explained here]): vsched --xid <xid> --fill-rate <fill-rate> --interval <interval> \ --fill-rate2 <fill-rate2> --interval2 <interval2> \ --tokens-max <tokens-max> --tokens-min <tokens-min> --idle-time --force it's important to use the option ''--force'' so the limit is applied at the same time in the cpus. If you want to enable fair share (i.e, idle-time) for the vserver, make sure to use the ''--idle-time'' option at the previous command. Then you should check at ''/proc/virtual/<xid>/sched'' (more info [http://linux-vserver.org/ProcFS#sched here]). Try a command like watch -n1 cat /proc/virtual/<xid>/sched If the collum "Ticks spent on hold" is greater than zero and the flag "On hold (H) or running (R)" assumes the hold value, then its working :) If you want to remove the scheduling, use the command vattribute --set --xid <xid> --flag ~sched_hard But remember that these instructions just cover setting limits in a running vserver. To save the values you choose please refer to the [http://www.nongnu.org/util-vserver/doc/conf/configuration.html great flower page]. [[Category:Documentation]]
Summary:
Please note that all contributions to Linix VServer may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Linix VServer:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
About
Overview
Paper
News
Developers
Donations
Search
Getting Started
Downloads
FAQs
Documentation
Support
Participate
How to participate
Report a Bug
Communicate
Teams/Projects
Hall of Fame
Resources
Archives
Recent Wiki Changes
Pastebin
Related Projects
VServer Hosting
Happy VServer Users
Tools
What links here
Related changes
Special pages
Page information