Date: Sat, 25 Feb 2006 06:54:14 +0800 From: David Xu <davidxu@freebsd.org> To: Kazuaki Oda <kaakun@highway.ne.jp> Cc: freebsd-current@freebsd.org Subject: Re: calcru: runtime went backwards Message-ID: <43FF8E96.5040203@freebsd.org> In-Reply-To: <43FE9BC3.5070909@highway.ne.jp> References: <43FE4E26.4060507@freebsd.org> <43FE9BC3.5070909@highway.ne.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
Kazuaki Oda wrote: > > I've been getting calcru messages on 6-STABLE when stress-testing an > application linked with libpthread. As far as my experience goes, > these messages are only for ones linked with libpthread. If the same > application is linked with libthr, these messages go away. > > As I post about the same issue on -CURRENT a few days ago, I guess > these messages are caused by the programs which access process states. > ps(1), top(1) etc. Because if I run the following command on the test > target machine, I can easily get them. > % sh -c "while true; do ps ax >/dev/null; done" > > I hope this issue will be fixed before 6.1-RELEASE. > > > ---- > Kazuaki Oda > > Can you try following patch on a 6-STABLE machine? Index: kern_thread.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v retrieving revision 1.216.2.1 diff -u -r1.216.2.1 kern_thread.c --- kern_thread.c 4 Oct 2005 22:53:56 -0000 1.216.2.1 +++ kern_thread.c 24 Feb 2006 22:51:08 -0000 @@ -439,6 +439,7 @@ void thread_exit(void) { + struct bintime new_switchtime; struct thread *td; struct proc *p; struct ksegrp *kg; @@ -566,6 +567,15 @@ */ PROC_UNLOCK(p); } + + /* Do the same timestamp bookkeeping that mi_switch() would do. */ + binuptime(&new_switchtime); + bintime_add(&p->p_rux.rux_runtime, &new_switchtime); + bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime)); + PCPU_SET(switchtime, new_switchtime); + PCPU_SET(switchticks, ticks); + cnt.v_swtch++; + td->td_state = TDS_INACTIVE; CTR1(KTR_PROC, "thread_exit: cpu_throw() thread %p", td); cpu_throw(td, choosethread());
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43FF8E96.5040203>