<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>FW: About runqueues in Linux</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<BR>
<BR>

<P><FONT SIZE=2>-----Original Message-----<BR>
From: Schick, Stefan<BR>
Sent: Thu 12/23/2010 12:52 PM<BR>
To: Sowmya Sridharan<BR>
Subject: RE: About runqueues in Linux<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: kernelnewbies-bounces@kernelnewbies.org on behalf of Sowmya Sridharan<BR>
Sent: Thu 12/23/2010 11:58 AM<BR>
To: kernelnewbies@kernelnewbies.org<BR>
Subject: About runqueues in Linux<BR>
<BR>
Greetings List,<BR>
<BR>
I have certain queries regarding the maintenance of runqueues in Linux.<BR>
In case of an SMP system, will a same process be added to multiple<BR>
runqueues?<BR>
<BR>
In the sample data given below, I am seeing that the process &quot;Appstart&quot; is<BR>
added to the runqueue on CPU1, but it is not run on that CPU. Instead it<BR>
is added to CPU0's runqueue, and it is run on that CPU. I have not affined<BR>
the process to any CPU, and it is not multi-threaded.<BR>
<BR>
CPU1 data:<BR>
Cpu: 1, HRT: 1290079896.698994, Pid: 6577, Pname: Appstart<BR>
added_to_runqueue, current process: irc(6103)<BR>
Cpu: 1, HRT: 1290079896.706994, Pid: 6103, Pname: irc<BR>
added_to_runqueue,current process: swapper(0)<BR>
<BR>
CPU0 data:<BR>
Cpu: 0, HRT: 1290079896.702994, Pid: 6577, Pname: Appstart<BR>
added_to_runqueue, Current process: eventd(5370)<BR>
Cpu: 0, HRT: 1290079896.702994, Pid: 14247, Pname: Conn_agent<BR>
added_to_runqueue, Current process: Appstart(6577)<BR>
<BR>
What is the default CPU on which a process runs, if cpu affinity is not<BR>
set?<BR>
Is it possible that a process added to one runqueue can be moved to<BR>
another runqueue?<BR>
Also I have seen swapper getting scheduled frequently even if there are<BR>
runnable processes. Shouldn't swapper be run, only if there are no<BR>
runnable processes?<BR>
<BR>
Your insights will be appreciated.<BR>
<BR>
Regards,<BR>
Sowmya<BR>
=====-----=====-----=====<BR>
Notice: The information contained in this e-mail<BR>
message and/or attachments to it may contain<BR>
confidential or privileged information. If you are<BR>
not the intended recipient, any dissemination, use,<BR>
review, distribution, printing or copying of the<BR>
information contained in this e-mail message<BR>
and/or attachments to it are strictly prohibited. If<BR>
you have received this communication in error,<BR>
please notify us by reply e-mail or telephone and<BR>
immediately and permanently delete the message<BR>
and any attachments. Thank you<BR>
<BR>
Hey Sowmya,<BR>
one process can only be in one runqueue at the same time.<BR>
<BR>
What is the default CPU on which a process runs, if cpu affinity is not set?<BR>
The CPU with the shortest runqueue.<BR>
<BR>
Is it possible that a process added to one runqueue can be moved to another runqueue?<BR>
Yes, they can be pulled over, see load_balance() in sched_fair.c<BR>
<BR>
Also I have seen swapper getting scheduled frequently even if there are<BR>
runnable processes. Shouldn't swapper be run, only if there are no<BR>
runnable processes?<BR>
No, because it is possible that a Process in the expired runqueue is starving.<BR>
<BR>
Regards<BR>
Stefan<BR>
</FONT>
</P>

</BODY>
</HTML>