All of lore.kernel.org
 help / color / mirror / Atom feed
* Use of SCHED_SOFTIRQ
@ 2015-01-28 16:55 Sreejith M M
  2015-01-28 17:53 ` Vignesh Radhakrishnan
  0 siblings, 1 reply; 4+ messages in thread
From: Sreejith M M @ 2015-01-28 16:55 UTC (permalink / raw)
  To: kernelnewbies

Hi,

I was reading LKD by Robert Love. I got the following idea from the book.


Correct me if I am worng
I was checking through source code and I found that on every timer
interrupt, through sched/fair.c we are raising the SCHED_SOFTIRQ().
I was checking the relation between SCHED_SOFTIRQ and actual
__schedule() function.

My assumption:
schedule() function is the function which selects the processes which
are ready to run  in run queue. schedule() function is called in every
timer tick.

What I was thinking is that schedule() will be called as part of
handling SCHED_SOFTIRQ() . But in source code, SCHED_SOFTIRQ is
handled through run_rebalance_domain() function (sched/fair.c) . I am
unable to trace __schedule()  from this function.

Am I missing anything or my assumptions are wrong?
-- 
Regards,
Sreejith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Use of SCHED_SOFTIRQ
  2015-01-28 16:55 Use of SCHED_SOFTIRQ Sreejith M M
@ 2015-01-28 17:53 ` Vignesh Radhakrishnan
  2015-01-28 19:05   ` Sreejith M M
  2015-01-29  0:22   ` nick
  0 siblings, 2 replies; 4+ messages in thread
From: Vignesh Radhakrishnan @ 2015-01-28 17:53 UTC (permalink / raw)
  To: kernelnewbies

Hey Sreejith,


softirq's are run as bottom half processing (after an interrupt is handled
or when there is no work to be done -
https://www.kernel.org/doc/htmldocs/kernel-hacking/basics-softirqs.html )
and sched_softirq is one such soft irq whose only function is confined to
the routine run_rebalance_domain().


__schedule() is the main scheduling function that tries to pick the next
task and then perform context switch and other associated scheduling
functions. Since run_rebalance_domain() need not be run at that exact time
frame, it is scheduled for later time when the cpu can take it up using
softirq's. Therefore __schedule() need not be called in this softirq
context as such because these are independent operations.

Hope this helps.

Thanks and regards,
Vignesh Radhakrishnan

On Wed, Jan 28, 2015 at 10:25 PM, Sreejith M M <sreejith.mm@gmail.com>
wrote:

> Hi,
>
> I was reading LKD by Robert Love. I got the following idea from the book.
>
>
> Correct me if I am worng
> I was checking through source code and I found that on every timer
> interrupt, through sched/fair.c we are raising the SCHED_SOFTIRQ().
> I was checking the relation between SCHED_SOFTIRQ and actual
> __schedule() function.
>
> My assumption:
> schedule() function is the function which selects the processes which
> are ready to run  in run queue. schedule() function is called in every
> timer tick.
>
> What I was thinking is that schedule() will be called as part of
> handling SCHED_SOFTIRQ() . But in source code, SCHED_SOFTIRQ is
> handled through run_rebalance_domain() function (sched/fair.c) . I am
> unable to trace __schedule()  from this function.
>
> Am I missing anything or my assumptions are wrong?
> --
> Regards,
> Sreejith
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
http://vigneshradhakrishnan.blogspot.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150128/a039a35f/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Use of SCHED_SOFTIRQ
  2015-01-28 17:53 ` Vignesh Radhakrishnan
@ 2015-01-28 19:05   ` Sreejith M M
  2015-01-29  0:22   ` nick
  1 sibling, 0 replies; 4+ messages in thread
From: Sreejith M M @ 2015-01-28 19:05 UTC (permalink / raw)
  To: kernelnewbies

Hi Vignesh,

Thank you.
I understood from your description that SCHED_SOFTIRQ has no relation
with scheduling directly but only deals with load balancing between
groups.

I have one more question regarding timer interrupts and its relation
to schedule() function. As I said, my understanding was that
schedule() function is invoked in 2 cases
1. When a process goes to sleep or waiting for a resource
2. For each timer tick

Regarding point 2, I am still not clear how each timer tick invokes
the scheduler.Please give any pointers

On Wed, Jan 28, 2015 at 11:23 PM, Vignesh Radhakrishnan
<vignesh1192@gmail.com> wrote:
> Hey Sreejith,
>
>
> softirq's are run as bottom half processing (after an interrupt is handled
> or when there is no work to be done -
> https://www.kernel.org/doc/htmldocs/kernel-hacking/basics-softirqs.html )
> and sched_softirq is one such soft irq whose only function is confined to
> the routine run_rebalance_domain().
>
>
> __schedule() is the main scheduling function that tries to pick the next
> task and then perform context switch and other associated scheduling
> functions. Since run_rebalance_domain() need not be run at that exact time
> frame, it is scheduled for later time when the cpu can take it up using
> softirq's. Therefore __schedule() need not be called in this softirq context
> as such because these are independent operations.
>
> Hope this helps.
>
> Thanks and regards,
> Vignesh Radhakrishnan
>
> On Wed, Jan 28, 2015 at 10:25 PM, Sreejith M M <sreejith.mm@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I was reading LKD by Robert Love. I got the following idea from the book.
>>
>>
>> Correct me if I am worng
>> I was checking through source code and I found that on every timer
>> interrupt, through sched/fair.c we are raising the SCHED_SOFTIRQ().
>> I was checking the relation between SCHED_SOFTIRQ and actual
>> __schedule() function.
>>
>> My assumption:
>> schedule() function is the function which selects the processes which
>> are ready to run  in run queue. schedule() function is called in every
>> timer tick.
>>
>> What I was thinking is that schedule() will be called as part of
>> handling SCHED_SOFTIRQ() . But in source code, SCHED_SOFTIRQ is
>> handled through run_rebalance_domain() function (sched/fair.c) . I am
>> unable to trace __schedule()  from this function.
>>
>> Am I missing anything or my assumptions are wrong?
>> --
>> Regards,
>> Sreejith
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
>
> --
> http://vigneshradhakrishnan.blogspot.com/



-- 
Regards,
Sreejith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Use of SCHED_SOFTIRQ
  2015-01-28 17:53 ` Vignesh Radhakrishnan
  2015-01-28 19:05   ` Sreejith M M
@ 2015-01-29  0:22   ` nick
  1 sibling, 0 replies; 4+ messages in thread
From: nick @ 2015-01-29  0:22 UTC (permalink / raw)
  To: kernelnewbies

Vignesh,
You forgot to mention that schedule does not itself pick the next task.
The actual function called is pick_next_task which uses the leftmost
cached entry in the red black tree of able to run processes to run
next.
Nick

On 2015-01-28 12:53 PM, Vignesh Radhakrishnan wrote:
> Hey Sreejith,
> 
> 
> softirq's are run as bottom half processing (after an interrupt is handled
> or when there is no work to be done -
> https://www.kernel.org/doc/htmldocs/kernel-hacking/basics-softirqs.html )
> and sched_softirq is one such soft irq whose only function is confined to
> the routine run_rebalance_domain().
> 
> 
> __schedule() is the main scheduling function that tries to pick the next
> task and then perform context switch and other associated scheduling
> functions. Since run_rebalance_domain() need not be run at that exact time
> frame, it is scheduled for later time when the cpu can take it up using
> softirq's. Therefore __schedule() need not be called in this softirq
> context as such because these are independent operations.
> 
> Hope this helps.
> 
> Thanks and regards,
> Vignesh Radhakrishnan
> 
> On Wed, Jan 28, 2015 at 10:25 PM, Sreejith M M <sreejith.mm@gmail.com>
> wrote:
> 
>> Hi,
>>
>> I was reading LKD by Robert Love. I got the following idea from the book.
>>
>>
>> Correct me if I am worng
>> I was checking through source code and I found that on every timer
>> interrupt, through sched/fair.c we are raising the SCHED_SOFTIRQ().
>> I was checking the relation between SCHED_SOFTIRQ and actual
>> __schedule() function.
>>
>> My assumption:
>> schedule() function is the function which selects the processes which
>> are ready to run  in run queue. schedule() function is called in every
>> timer tick.
>>
>> What I was thinking is that schedule() will be called as part of
>> handling SCHED_SOFTIRQ() . But in source code, SCHED_SOFTIRQ is
>> handled through run_rebalance_domain() function (sched/fair.c) . I am
>> unable to trace __schedule()  from this function.
>>
>> Am I missing anything or my assumptions are wrong?
>> --
>> Regards,
>> Sreejith
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
> 
> 
> 
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-29  0:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 16:55 Use of SCHED_SOFTIRQ Sreejith M M
2015-01-28 17:53 ` Vignesh Radhakrishnan
2015-01-28 19:05   ` Sreejith M M
2015-01-29  0:22   ` nick

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.