LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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-24-2010, 09:19 PM   #1
sobrier
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
The contrary effect taken by using taskset command to set processor affinity


Hi,
I have tried to set processor affinity for a certain task with "taskset" command
,but it takes contrary effect .
Here is my operations:
#taskset -p 0x00000001 9440 ;binding process qemu-system-x86_64 to run on #cpu0
but the cpu utilizaion from seeing "top": #cpu 1 is much busier than #cpu 0.
And,I do this:
#taskset -p 0x00000002 9440 ;binding process to run on #cpu1
from "top",see #cpu 0 is much busier than #cpu 1.
However,From "htop",I see two qemu processesid 9440 and pid 9441,but i have launched only one qemu process.I do it again:
#taskset -p 0x00000001 9441 ;
#taskset -p 0x00000002 9441
this time,it works right effect.
OH....I am so puzzled,so,i do these on the another computer which has the same hardware and Debian Lenny OS.Another problem happens:
After install htop,it works opposite effect as the first computer,so,i remove the htop command,and then set processor affinity,it works right.so,i think htop may be something wrong.
But,i remove the htop command on the fist computer,it still works contrary.so,htop may be not the only problem.
i can't solve this,any help can be appreciated!
 
Old 07-24-2010, 11:50 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
What happens when you start the process using taskset ?
You can see whether the affinity has been applied by using
Code:
taskset -p <pid>
Also, it is much easier and clearer to use the -c option for the cpu numbers
Code:
taskset -p -c 0 <pid>
or
Code:
taskset -p -c 1 <pid>
 
Old 07-25-2010, 01:59 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,353

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
Poor option if there is the possibility of child processes. Have a look at cgroups where they can all be contained without having to know pid or process name in advance.
 
  


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
[SOLVED] problems with cpu affinity, wine and Mass Effect 2 gimli01 Linux - Games 2 07-17-2010 02:49 AM
CPU affinity / taskset does not always work. lwi Ubuntu 3 03-01-2010 12:49 PM
taskset and affinity masks tethysgods Linux - Software 1 01-16-2010 12:29 PM
Using taskset to set process affinity on multi-core/hyperthreading lennyk Linux - Software 0 04-06-2009 09:29 AM
Can you set processor affinity on Linux? Thaidog Linux - General 1 02-27-2008 09:31 AM


All times are GMT -5. The time now is 10:54 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