On Monday 23. March 2009 06.37.30 Peter Chen wrote: > Thanks, Henrik. > > I knew where the HZ value defined, my platform is ARM, so it is 100. > I just want to know where the code for formula: > base time quantum = (140-static priority)*20 if static priority < 120 > > (140-static priority)*20 if static > priority >=120 > > or it is deleted at New kernel version, the kernel code I used is > 2.6.27. 2.6.27 uses the CFS, and CFS does not use priorities like that. So yes, that function has been removed. :-) Anyway, that formula was only used to calculate the time quantum. That would then be adjusted according to how much time the task spent on the CPU. Have a look at http://folk.ntnu.no/henrikau/sched/rt_sched_pro.pdf in section 2.4. I wrote it last christmas, and even though not all of it is dead on, I think it explains some of the scheduling details. > > >>Actually, most likely, the IRQ will set TIF_NEED_RESCHED. > > I checked the code only timer IRQ will set TIF_NEED_RESCHED, > are there any common irqs will cause process be preempted? > I can't find at irq_handler, and irq_exit(). Hmm, are you sure? How about the function: static void rescehd_task(struct task_struct *p) in kernel/sched.c ? :-) AFAIK, IRQ's alone won't cause a reschedule. *but*, the effect of an IRQ may lead to rescheduling. That's a subtle difference. For instance, timer interrupts may cause reschedule, data available from disk may cause reschedule, from a network interface etc etc. > Best Regards, > Peter Chen -- med vennlig hilsen - Yours Sincerely, Henrik Austad
Attachment:
signature.asc
Description: This is a digitally signed message part.