Gilles Chanteperdrix wrote: > Philippe Gerum wrote: > > On Fri, 2006-07-07 at 01:47 +0200, Gilles Chanteperdrix wrote: > > > Philippe Gerum wrote: > > > > > +#ifdef CONFIG_XENO_OPT_STATS > > > > > +static inline void xnpod_acc_exec_time(xnsched_t *sched, > > > > > + xnthread_t *threadout) > > > > > +{ > > > > > + xnticks_t now = xntimer_get_rawclock(); > > > > > + threadout->stat.exec_time += now - sched->last_csw; > > > > > + sched->last_csw = now; > > > > > +} > > > > > > > > It would be better to only pass the thread pointer, then use the > > > > thread->sched member. This would clearly explain the relationship > > > > between both, and prevent any bugous attempt at mixing things. > > > > > > Beware, when xnpod_schedule is called from within > > > xnpod_migrate_thread(), the sched pointer of the switched out thread is > > > the one of the destination cpu. So, passing the sched and threadout > > > pointers to xnpod_acc_exec_time is safer. > > > > Nope, the nklock is held by the migrating thread all along until the > > switch has actually occured. > > xnpod_acc_exec_time() is called from within xnpod_schedule() that is > called from within xnpod_migrate_thread() at a time where > threadout->sched is the wrong pointer. > True, will revert this. Thanks, Jan