Re: scheduler context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ratheesh,

I ll give a try.

On Wed, Apr 17, 2013 at 9:43 PM, ratheesh kannoth <ratheesh.ksz@xxxxxxxxx> wrote:
I would like to understand on linux scheduler context. I have read a
lot in websites and i could find
contradictory statement. There are so many mailing list also ,but with
less info. I would really appreciate
if anybody could spend some time answering my question.

1. Which context scheduler run ? ( process context or interrupt context ).
 
Process context. That is when preempt_count equal 0
 
2. scheduler is the guy  who picks up the next candidate to run.  if
it gets interrupted by hardirq, what will happen ?
 
scheduler resumes from where it was stopped, after finishing hardirq handler(and softirq handlers if any)
 
3. if scheduler run in process context , how bottom half are scheduled ?

Bottom halves(softirqs and tasklets) are not scheduled by scheduler.
ISR is executed in_irq() context or with preempt count added with HARDIRQ_OFFSET. 
Local interrupts are disabled in_irq() context.

After completing ISR, irq_exit() function checks for any pending softirqs, if yes it invokes invoke_softirq() to service all pending softirqs with interrrupts enabled.
When softirqs runs, preempt count will be added with SOFTIRQ_OFFSET. 

4. In smp, schedule() function may be called  simultaneously. How it
is handled ?

Each core has its own runqueue which is a per_cpu variable.
 
5. When a bottom half is interrupted  by hard irq, how softirq kernel
thread saves the state and restart it later ? ...what i mean is , an
   hardirq came and its isr executed. bottom half enabled and bottom
half gets scheduled . Before bottom half is completed , next irq
   came and it enables bottom half , and the new bottom half is
scheduled ....So here , what will happen to old bottom half , will it
again
   run later ?
 
The old bottom half handler(which was preempted by irq) will be resumed after the hardirq isr.
Followed by the next bottom half.

Refer function  __do_softirq in kernel/softirq.c 

Thanks,
Arun



Thanks,
Ratheesh

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux