cpuset usage for a specific process

Hello,

I have a Java process that's running on 8 CPU cores on FreeBSD 8.3-STABLE. I can assign the process to 5-7 CPU cores with:

cpuset -l 5-7 -p $javapid

When I did that another application's processes use those cores some times. For example: I see with top: sshd, httpd applications use cpu6, cpu5 some times.

I want to see only the Java process on those cores and other applications shouldn't use those CPU cores (5-7).

What is the correct way to do that?

Thanks,
Regards
 
Try cpuset -s1 -l0-4. That will change the CPU mask for set 1 (default set) to processors 0-4, and it should apply to any process you haven't otherwise called cpuset for.

Kevin Barry
 
Why do I get this error message?

Code:
dc:/opt/app/bin# cpuset -s 1 -l 5-7
cpuset: setaffinity: Resource deadlock avoided

ta0kira said:
Try cpuset -s1 -l0-4. That will change the CPU mask for set 1 (default set) to processors 0-4, and it should apply to any process you haven't otherwise called cpuset for.

Kevin Barry
 
From the manpage for the system call itself (not the command):
man 2 cpuset said:
Code:
     [EDEADLK]          The cpuset_setid() call would leave a thread without a
                        valid CPU to run on because the set does not overlap
                        with the thread's anonymous mask.
I was suggesting that you assign set 1 to the CPUs that aren't being used by JVM. My suggestion is in addition to what you said you're already doing.

Kevin Barry
 
ta0kira said:
From the manpage for the system call itself (not the command):I was suggesting that you assign set 1 to the CPUs that aren't being used by JVM. My suggestion is in addition to what you said you're already doing.

Kevin Barry

I added /usr/bin/cpuset -l 0 -s 1 to the /etc/rc.local file and It worked like a charm at startup. Then I tried to assign java process with cpuset -l 1 -p 1012 and I got the same error message for one process:
Code:
cpuset: setaffinity: Resource deadlock avoided

I didn't understand the logic of cpuset usage. set 1 (default) assigned to cpu0.

If by default cpuset(1) works on cpu0, how should I call an application for running on cpu1?
 
vecihi said:
I added /usr/bin/cpuset -l 0 -s 1 to the /etc/rc.local file and It worked like a charm at startup. Then I tried to assign java process with cpuset -l 1 -p 1012 and I got the same error message for one process:
Code:
cpuset: setaffinity: Resource deadlock avoided

I didn't understand the logic of cpuset usage. set 1 (default) assigned to cpu0.

If by default cpuset(1) works on cpu0, how should I call an application for running on cpu1?
Try adding the -C argument, which will create a new CPU set and add the process to it, e.g. cpuset -C -c -l 5-7 -p $javapid.

Kevin Barry
 
Back
Top