Kernel thread scheduling

nick xerofoify at gmail.com
Thu Apr 9 22:52:03 EDT 2015



On 2015-04-09 10:12 PM, Ruben Safir wrote:
> On 04/09/2015 10:00 PM, nick wrote:
>>
>>
>> On 2015-04-09 09:51 PM, Ruben Safir wrote:
>>>
>>> It is passover so I've read over much of this text, but I have to say
>>> that in general, I'm way ahead of this book.  Although I have limited
>>> knowledge of Kernel technology in the specific, the C code, data
>>> structs, and programming concepts are spoon feed in this text and its
>>> wasting too much time with words that are more easily explained with
>>> coding examples and UML charts.  I don't need a chapter explaining how
>>> to use ps and the basis of Unix architecture.  This text is targeted to
>>> a different audience, and FWIW, I'm not certain it does a good job of
>>> that either.  The guys who write these texts fall in love with their own
>>> voices.  I know, I've suffered this disease myself when I've written
>>> tech articles and books.
>>>
>>> I can''t recommend this book to anyone.  Anyone who doesn't understand
>>> the basics of I/O processer blocks is not going to understand
>>>
>>> static void update_curr(struct cfs_rq *cfs_rq)
>>>
>>>
>>> and OTOH void update_curr(struct cfs_rq *cfs_rq) is not explained well
>>> enough for coders unfamiliar with the kernel data structs of which BTW
>>> struct cfs_rq is not one defined in the text.
>>>
>>> :(
>>>
>>> I'm looking for something more like this, but flushed out more as a textbook
>>>
>>> http://www.ibm.com/developerworks/library/l-completely-fair-scheduler/index.html,
>>> and some mentoring, I hope.
>>>
>>>
>>> Ruben
>>>

>> Ruben,
>> The book is for an intro to the kernel not a complete walk through of each subsystem.
>> If that is the case,why not read the subsystem code and docs in the kernel. I am a
>> novice myself in terms of patch and coding experience but will be glad to explain the
>> code as I have read lots of it.
> 
> 
> Thank you nick.  Yes, I downloaded the entire source from Kernel.org and
> it is sitting on both my laptop and in virtual machines where I have
> already compiled some stuff and not broken my VMs yets :)
> 
> I'm looking over  /home/ruben/linux-3.19.3/Documentation/scheduler
> [ruben at stat13 scheduler]$ ls
> 
> 00-INDEX   sched-deadline.txt     sched-rt-group.txt
> media=legal -o sides=two-sided-long-edg  sched-design-CFS.txt
> sched-stats.txt sched-arch.txt sched-domains.txt
> sched-bwc.txt   sched-nice-design.txt
> 
> 
> I also see in the code there is significant documentation.
> 
> Right now I am trying to figure out what is the relationship between
> struct sched_entity and
> struct cfs_rq and
> struct rq_of
> 
> why do we have both??
> 
The way that these structures  are related is sched_enity is the entity for the task's scheduling
information or the task_struct of the a excuting process to be exact. Furthermore  cfs_rq is the
runquenue on which the task is running or selected to run on by schedule,the main scheduling function
of the kernel. Finally here is the function definition for rq_of to answer your question,
static inline struct rq *rq_of(struct cfs_rq *cfs_rq)
{
 	return cfs_rq->rq;
}
Before asking questions again like this please look into either using lxr or ctags
to navigate the kernel tree for answers as can be faster then waiting for me or 
someone else to respond.
Thanks,
Nick
> there is a cast in update_curr
> u64 now = rq_of(cfs_rq)->clock;
> 
> or is rq_of a function that returns a pointer is a struct that I missed?
> 
> 
> 
> 
> 
>> Nick
>>> On 03/22/2015 08:35 PM, nick wrote:
>>>>
>>>>
>>>> On 2015-03-22 08:05 PM, Ruben Safir wrote:
>>>>> On 03/22/2015 07:30 PM, nick wrote:
>>>>>> I would recommend reading Chapters 3 and  4 of Linux Kernel Development by Robert Love
>>>>>> as when I was learning the scheduler and process management
>>>>>
>>>>>
>>>>> how much has the scheduler changed since then.  It was completely
>>>>> overhauled when the CFS was created
>>>>>
>>>>>
>>>>>
>>>> The 3rd edition of this book was written after CFS was in the kernel so the chapters
>>>> are pretty up to date.
>>>> Nick
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>> .
>>>>
>>>
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>
>>
> 



More information about the Kernelnewbies mailing list