Con Kolivas wrote: > On Tuesday 21 February 2006 17:21, Peter Williams wrote: > >>Con Kolivas wrote: >> >>>Would be just a matter of using task_timeslice(p) and making it >>>proportional to some baseline ensuring the baseline works at any HZ. >> >>How does the attached patch grab you? It's independent of HZ. > > > Looks good thanks. > I think that there's a way that we can leverage this to make task_timeslice() more efficient by calculating it in terms of the task's load_weight. I.e. if the value of load_weight is established based on the current time slice formula then it will be a simple mapping (basically, just a scaling) from load_weight to time slice. Scaling is at most a multiply and a divide where the current cost of task_timeslice() is 2 comparisons, a subtraction, a multiply and a divide (after you take account of the multiplies and divides that the compiler would do at compile time). Attached is a patch for comment. NB I had to add an extra comparison in sched_timeslice() to maintain the relationship between "nice" and time slice allocations to RT tasks. I don't know whether this relationship is deliberate (as there are comments in set_user_nice() to the effect that static_prio is just updated for RT tasks in case they become non RT tasks and has no effect on scheduling). If it's not and higher time slice allocations for RT tasks would be acceptable (only really matters for SCHED_RR except for where task_timeslice() is used in sched_exit() and dependent_sleeper()) then this could be simplified. Comments, Please? Peter -- Peter Williams pwil3058@bigpond.net.au "Learning, n. The kind of ignorance distinguishing the studious." -- Ambrose Bierce