* How does 2.6 SMP scheduler initially assign a thread to a run queue?
@ 2005-06-07 23:50 helen monte
2005-06-08 12:41 ` lk
0 siblings, 1 reply; 6+ messages in thread
From: helen monte @ 2005-06-07 23:50 UTC (permalink / raw)
To: linux-kernel
In the 2.6 kernel, there is one run queue per CPU, in case of an SMP.
After a thread is created, how does the scheduler determine which run
queue it goes to? I know that once it goes to a particular run queue,
the scheduler would try to run that thread on that CPU to take
advantage of processor affinity; and then there would be the load
balancing stuff. But at the very beginning, what algorithm does the
scheduler use to assign a newly created thread to a particulat CPU?
Would the load balancing algorithm be used? Or gang scheduling?
By the way, in an SMT/hyperthreading processor, does the latest kernel
version assign one run queue per physical CPU, or per virtual processor?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How does 2.6 SMP scheduler initially assign a thread to a run queue?
2005-06-07 23:50 How does 2.6 SMP scheduler initially assign a thread to a run queue? helen monte
@ 2005-06-08 12:41 ` lk
2005-06-08 19:03 ` Siddha, Suresh B
0 siblings, 1 reply; 6+ messages in thread
From: lk @ 2005-06-08 12:41 UTC (permalink / raw)
To: helen monte, linux-kernel
>
> In the 2.6 kernel, there is one run queue per CPU, in case of an SMP.
> After a thread is created, how does the scheduler determine which run
> queue it goes to?
First it forked process (child) gets the same CPU as that of parent.
forking a child gets the same CPU and later part of fork will call
wake_up_new_task () to fetch the run-queue of the CPU and
__activate_task () is called to move task into run-queue.
Later rescheduling of the process may move process to another
run-queues.
>I know that once it goes to a particular run queue,
> the scheduler would try to run that thread on that CPU to take
> advantage of processor affinity; and then there would be the load
> balancing stuff. But at the very beginning, what algorithm does the
> scheduler use to assign a newly created thread to a particulat CPU?
Child will always goes to the parent's run-queue (CPU) for the first time.
> Would the load balancing algorithm be used? Or gang scheduling?
Yes, load balancing algorithm is used. tasks will be pulled from
very busy processors to lesser busy processors.
> By the way, in an SMT/hyperthreading processor, does the latest kernel
> version assign one run queue per physical CPU, or per virtual
> processor?
>
one run-queue per physical CPU
regards
lk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How does 2.6 SMP scheduler initially assign a thread to a run queue?
2005-06-08 12:41 ` lk
@ 2005-06-08 19:03 ` Siddha, Suresh B
2005-06-08 19:25 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Siddha, Suresh B @ 2005-06-08 19:03 UTC (permalink / raw)
To: lk; +Cc: helen monte, linux-kernel
On Wed, Jun 08, 2005 at 06:11:55PM +0530, lk wrote:
> > In the 2.6 kernel, there is one run queue per CPU, in case of an SMP.
> > After a thread is created, how does the scheduler determine which run
> > queue it goes to?
>
> First it forked process (child) gets the same CPU as that of parent.
> forking a child gets the same CPU and later part of fork will call
> wake_up_new_task () to fetch the run-queue of the CPU and
> __activate_task () is called to move task into run-queue.
> Later rescheduling of the process may move process to another
> run-queues.
In -mm kernels, Nick has recently added balance on exec/fork.
> > By the way, in an SMT/hyperthreading processor, does the latest kernel
> > version assign one run queue per physical CPU, or per virtual
> > processor?
> >
>
> one run-queue per physical CPU
No. Each logical processor has its own runqueue.
thanks,
suresh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How does 2.6 SMP scheduler initially assign a thread to a run queue?
2005-06-08 19:03 ` Siddha, Suresh B
@ 2005-06-08 19:25 ` Steven Rostedt
2005-06-09 6:32 ` How does 2.6 SMP scheduler assign runqueues to multi-cores? helen monte
0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2005-06-08 19:25 UTC (permalink / raw)
To: Siddha, Suresh B; +Cc: linux-kernel, helen monte, lk
On Wed, 2005-06-08 at 12:03 -0700, Siddha, Suresh B wrote:
> > > By the way, in an SMT/hyperthreading processor, does the latest kernel
> > > version assign one run queue per physical CPU, or per virtual
> > > processor?
> > >
> >
> > one run-queue per physical CPU
>
> No. Each logical processor has its own runqueue.
I think it is also worth mentioning that the sched domains are used to
help keep processes on the same physical CPU. Little cost associated to
moving a process from one logical CPU to a sibling, where as there is a
big cost in moving it to another physical CPU.
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* How does 2.6 SMP scheduler assign runqueues to multi-cores?
2005-06-08 19:25 ` Steven Rostedt
@ 2005-06-09 6:32 ` helen monte
2005-06-09 7:03 ` Nick Piggin
0 siblings, 1 reply; 6+ messages in thread
From: helen monte @ 2005-06-09 6:32 UTC (permalink / raw)
To: linux-kernel
> > > > By the way, in an SMT/hyperthreading processor, does the latest
>kernel
> > > > version assign one run queue per physical CPU, or per virtual
>processor?
> > > >
> > > one run-queue per physical CPU
> >
> > No. Each logical processor has its own runqueue.
How about muti-core? Does each core also have its own run queue? Does
anyone know how multi-core would work with SMT? Is it possible that they
work together? Is the following a possible scenario? : A node has two
processors, each processor has two cores, and each core has two "virtual
cores". And there are 8 run queues in total.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How does 2.6 SMP scheduler assign runqueues to multi-cores?
2005-06-09 6:32 ` How does 2.6 SMP scheduler assign runqueues to multi-cores? helen monte
@ 2005-06-09 7:03 ` Nick Piggin
0 siblings, 0 replies; 6+ messages in thread
From: Nick Piggin @ 2005-06-09 7:03 UTC (permalink / raw)
To: helen monte; +Cc: lkml
On Thu, 2005-06-09 at 06:32 +0000, helen monte wrote:
> > > > > By the way, in an SMT/hyperthreading processor, does the latest
> >kernel
> > > > > version assign one run queue per physical CPU, or per virtual
> >processor?
> > > > >
> > > > one run-queue per physical CPU
> > >
> > > No. Each logical processor has its own runqueue.
>
> How about muti-core? Does each core also have its own run queue? Does
> anyone know how multi-core would work with SMT? Is it possible that they
> work together? Is the following a possible scenario? : A node has two
> processors, each processor has two cores, and each core has two "virtual
> cores". And there are 8 run queues in total.
>
It is always one runqueue per virtual CPU, so dual core has 2 runqueues,
and dual core with SMT has 4 runqueues.
IBM and I believe Intel have chips that support SMT and have 2 cores.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-06-09 7:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-07 23:50 How does 2.6 SMP scheduler initially assign a thread to a run queue? helen monte
2005-06-08 12:41 ` lk
2005-06-08 19:03 ` Siddha, Suresh B
2005-06-08 19:25 ` Steven Rostedt
2005-06-09 6:32 ` How does 2.6 SMP scheduler assign runqueues to multi-cores? helen monte
2005-06-09 7:03 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox