On Monday 26 March 2007 01:19, malc wrote: > On Mon, 26 Mar 2007, Con Kolivas wrote: > > So before we go any further with this patch, can you try the following > > one and see if this simple sanity check is enough? > > Sure (compiling the kernel now), too bad old axiom that testing can not > confirm absence of bugs holds. > > I have one nit and one request from clarification. Question first (i > admit i haven't looked at the surroundings of the patch maybe things > would have been are self evident if i did): > > What this patch amounts to is that the accounting logic is moved from > timer interrupt to the place where scheduler switches task (or something > to that effect)?
Both the scheduler tick and context switch now. So yes it adds overhead as I said, although we already do update_cpu_clock on context switch, but it's not this complex. > [..snip..] > > > * These are the 'tuning knobs' of the scheduler: > > @@ -3017,8 +3018,53 @@ EXPORT_PER_CPU_SYMBOL(kstat); > > static inline void > > update_cpu_clock(struct task_struct *p, struct rq *rq, unsigned long long > > now) { > > - p->sched_time += now - p->last_ran; > > + struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; > > + cputime64_t time_diff; > > + > > p->last_ran = rq->most_recent_timestamp = now; > > + /* Sanity check. It should never go backwards or ruin accounting */ > > + if (unlikely(now < p->last_ran)) > > + return; > > + time_diff = now - p->last_ran; > > A nit. Anything wrong with: > > time_diff = now - p->last_ran; > if (unlikeley (LESS_THAN_ZERO (time_diff)) > return; Does LESS_THAN_ZERO work on a cputime64_t on all arches? I can't figure that out just by looking myself which is why I did it the other way. -- -ck - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/