OpenVZ Forum


Home » Mailing lists » Users » How to set resource quota of other process
How to set resource quota of other process [message #25434] Tue, 25 December 2007 04:52 Go to next message
Ian jonhson is currently offline  Ian jonhson
Messages: 11
Registered: October 2007
Junior Member
Hi,

We all know that we can set resource quota of process with pam_limits.so.
The module can enforce the resource usage (cpu, memory, maximal number of
open file, etc) by setrlimit.

It seems that the function, setrlimit(), can only set self resource
quota of process and inherit by its child processes, right?

Because I adopted the function in one process to set another process'
resource quota, and found nothing enforced happen. The other process can run as
before, not any limitation.

I don't know whether what I have designed is correct, using the setrlimit to
set other process resource usage. If it is wrong, are there other ways to
accomplish my target?

Also, in OpenVZ, are there any auxiliary tools (or libraries, functions) to
do enforcement?


Thank you in advance.

Regards,
Ian
Re: How to set resource quota of other process [message #25435 is a reply to message #25434] Tue, 25 December 2007 06:48 Go to previous messageGo to next message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
man setrlimit
A privileged process (under Linux: one with the CAP_SYS_RESOURCE capability) may make arbitrary changes to either limit value.
Re: Re: How to set resource quota of other process [message #25439 is a reply to message #25435] Tue, 25 December 2007 16:50 Go to previous messageGo to next message
Ian jonhson is currently offline  Ian jonhson
Messages: 11
Registered: October 2007
Junior Member
an setrlimit
> A privileged process (under Linux: one with the CAP_SYS_RESOURCE capability) may make arbitrary changes to either limit value.


You mean that privileged process with the CAP_SYS_RESOURCE can enforce
the resource usage of other processes by setrlimit.

I am sorry, I googled the internet and man the setrlimit but I can not
find the relative information or example codes.

Could you give me some advices?


Thanks in advance.

Ian
Re: Re: How to set resource quota of other process [message #25445 is a reply to message #25439] Wed, 26 December 2007 06:49 Go to previous message
vaverin is currently offline  vaverin
Messages: 708
Registered: September 2005
Senior Member
Ian,

sorry for previous message, it was incorrect because I didn't understand Your original question.

You are right, setrlimit() set the limits for current process only (and for its new childern) and I don't know the ways to set these limits for some another processes.

OpenVZ uses own accounting/limiting subsytem that is not related to setrlimit(). OpenVZ allows to set some group identificator for current process only (like setrlimit), however then any privliged process can set the limits for this process group.

thank you,
Vasily Averin
Previous Topic: Live Migration Fails
Next Topic: Fedora core 7
Goto Forum:
  


Current Time: Tue Mar 19 06:47:23 GMT 2024

Total time taken to generate the page: 0.02427 seconds