LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 07-26-2011, 04:49 AM   #1
reg13
LQ Newbie
 
Registered: Jun 2011
Posts: 19

Rep: Reputation: Disabled
Problem in binding a process to CPU in multy core system


I have a 4core maching(hyperthreading disabled), SUSE linux 2.6.32, SMP enabled, at the boot time all the OS/kernel and other applications are limited to first 3 cores.
my need is that i have a daemon, which is quite CPU bound, thus I want the daemon to completely occupy
4th CPU. daemon is given high RT priority and sched_set_affinity system call is used to bind it. bind happens correctly.

But the problem is, when CPU utilization is checked, daemon always takes about 99% of CPU 4,
which means another process gets scheduled on that CPU, and context switching happens too. What is the reason for this?

system calls like sched_set_affinity binds a particular process to a given CPU.
But does that guarantees that, other processes want be running on that CPU?

Is there a way to make a process solely own a particular CPU?

Thankx in advance,
reg13.
 
Old 07-26-2011, 05:22 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,448

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
Quote:
Originally Posted by reg13 View Post
... at the boot time all the OS/kernel and other applications are limited to first 3 cores.
How do you enforce that ?
Quote:
But the problem is, when CPU utilization is checked, daemon always takes about 99% of CPU 4,
which means another process gets scheduled on that CPU, and context switching happens too.
Maybe, maybe not. Sampling error may also account for the (small) error.
Quote:
system calls like sched_set_affinity binds a particular process to a given CPU.
But does that guarantees that, other processes want be running on that CPU?
Not necessarily - depends (primarily) on how you bind everything else (presuming that is a typo, and you mean "won't").
Quote:
Is there a way to make a process solely own a particular CPU?
cgroups.
 
Old 07-26-2011, 06:14 AM   #3
reg13
LQ Newbie
 
Registered: Jun 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
How do you enforce that ?
using isolcpus=3, as a kernel boot parameter, this isolates CPU 4.

Quote:
Maybe, maybe not. Sampling error may also account for the (small) error.
Sampling error scenario is possible. May be i'll have to turn on scheduler debug info and see.

Quote:
Not necessarily - depends (primarily) on how you bind everything else (presuming that is a typo, and you mean "won't").
sorry for the typo. yes its won't.

Quote:
cgroups.
thankx, I'll have to read about this and find out how to use this.
 
Old 07-26-2011, 08:57 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,448

Rep: Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069Reputation: 1069
Quote:
Originally Posted by reg13 View Post
using isolcpus=3
In which case you should be fairly confident no other work is being dispatched on it.

BTW, cgroups is (now) what cpusets used to be - you may see the latter still mentioned in some doco. They are (for your purposes) the same.
 
Old 07-27-2011, 12:17 AM   #5
reg13
LQ Newbie
 
Registered: Jun 2011
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
In which case you should be fairly confident no other work is being dispatched on it.

BTW, cgroups is (now) what cpusets used to be - you may see the latter still mentioned in some doco. They are (for your purposes) the same.
The kernel documentation (http://www.kernel.org/doc/Documentat...parameters.txt) says that
"This option can be used to specify one or more CPUs to isolate from the general SMP balancing and scheduling
algorithms.
....
This option is the preferred way to isolate CPUs."
So, according to that, scheduler/load balancer should not put any process on the isolated CPUs, isn't it?

Other thing is that my daemon runs normally on polling mode (CPU usage 99%), when polling switched off, its CPU usage gets down to some 55%. How can this happen if there is no other process on that CPU's runqueue?.

sorry about the string of questions, appreciate your help syg00.

Last edited by reg13; 07-27-2011 at 02:13 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get process running CPU core and the utilisation on that core... chamila1986 Programming 5 04-28-2010 06:00 PM
How can you force a program/process to run on a specific CPU core? icedfusion Linux - Newbie 2 12-31-2008 11:10 AM
CPU binding - How to modify the CPU affinity mask? Thaidog Linux - General 1 03-15-2008 06:54 PM
Process System cpu rajesht Linux - General 1 05-19-2005 10:16 AM
problem with binding process and than execute another process chapa Programming 0 08-27-2003 04:47 AM


All times are GMT -5. The time now is 05:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration