---------- Forwarded message ---------- From: Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> Date: Thu, Mar 27, 2008 at 4:54 PM Subject: Re: Priority Inversion and Inheritance - Where is that? To: Peter Teoh <htmldeveloper@xxxxxxxxx> Hi Peter Happy Easter (if you celebrate it) :) On 3/27/08, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote: > Hi Mulyadi, > > How is life? Long time no hear!!! Life is good, but love life is not :D > According to the first podcast at (u check out the podcast?): > > http://www.timesys.com/services/podcast.htm Uhm, first time I heard timesys released podcasts....but thanks for sharing :) > Priority inversion (http://en.wikipedia.org/wiki/Priority_inversion) > is implemented in the Linux kernel - does anybody know where is that? Do you mean priority inversion detection? Because priority inversion is a "situation" and surely this is not something that is implemented. > And reading Documentation/rt-mutex-design.txt and > Documentation/pi-futex.txt does not helped. It increases my > confusion. > (as already indicated in the text - if u don't understand, it's ok). > > Intellectual challenges for you - care to share your understanding? > > a. WHere in kernel source are priority inversion / detection implemented? this is easily explained if you study Con Kolivas' staircase scheduler (yeah I know, it's not standart scheduler...but I pick it for easier explanation). In staircase scheduler, after every expiration of time slice, priority gets decremented... you can imagine it like a man walking down toward the bottom of the stair. If you relate it to priority inversion itself where higher prio task (task A) awaits for lower prio task (task B), staircase scheduler solves it by keep decrementing task B until prio +20 then it goes back to -19...during that time task A is still "sleeping" due to blocking. But once task B hits prio -19, it will run first instead task A...thus B can do some jobs...probably released a lock and wakes up A. I am sure, in not so different manner, Complete Fair Scheduling (CFS) is doing fairly same way.... IIRC, CFS took some basic principles from Con Kolivas' RSDL (Rotating Staircase Deadline ... advanced form of normal Staircase) > b. Where are the code that implement the priority inheritance logic? > > should be somewhere inside kernel/sched.c (for scheduling) and kernel/rtmutex.c? yup, but sorry I haven't studied CFS closely so I can locate it for you :D > I just saw a patch "+ > futex-runtime-enable-pi-and-robust-functionality.patch added to -mm > tree" in the LKML today - still trying to figure it out. Uhm...I'll see if I can check it ASAP.. regards, Mulyadi. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ