答复: [????] Re: [????] Re: divide error in x86 and cputime

From: Li,Rongqing
Date: Mon Jul 07 2025 - 22:03:39 EST


> "Li,Rongqing" <lirongqing@xxxxxxxxx> wrote:
>
> > > That would be:
> > >
> > > minutes days
> > > v v
> > > 9223372036854775808 / 1000000000 / 60 / 60 / 24 / 365.25 = 292.27
> > > ^ ^ ^
> > > ns -> sec hours years
> > >
> > > So the report says they have threads running for a very long time,
> > > it would still be 292 years of run time!
> >
> > Utime/rtime is u64, it means overflow needs 292.27*2=584 year,
> >
> > But with multiple thread, like 292 threads, it only need two years, it
> > is a thread group total running time
> >
> >
> > void thread_group_cputime_adjusted(struct task_struct *p, u64 *ut, u64
> > *st) {
> > struct task_cputime cputime;
> >
> > thread_group_cputime(p, &cputime);
> > cputime_adjust(&cputime, &p->signal->prev_cputime, ut, st); }
> >
>
> So you are saying that you have been running this for over two years without a
> reboot?
>

Yes, Consider more and more CPUs in machine, I think it is common case


> Then the issue isn't the divider, it's that the thread group cputime can overflow.
> Perhaps it needs a cap, or a way to "reset" somehow after "so long"?


Do not clear how to reset

But mul_u64_u64_div_u64() for x86 should not trigger a division error panic, maybe should return a ULLONG_MAX on #DE (like non-x86 mul_u64_u64_div_u64(),)

>
> -- Steve