lkml.org 
[lkml]   [2009]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: utime/stime decreasing on thread exit
On Tue, Nov 10, 2009 at 06:40:08PM +0100, Oleg Nesterov wrote:
> > One other exception is:
> > fastpath_timer_check() -> thread_group_cputimer() -> thread_group_cputime()
> >
> > We can solve this like that:
> >
> > --- a/kernel/posix-cpu-timers.c
> > +++ b/kernel/posix-cpu-timers.c
> > @@ -1375,13 +1375,8 @@ static inline int fastpath_timer_check(struct task_struct *tsk)
> > }
> >
> > sig = tsk->signal;
> > - if (!task_cputime_zero(&sig->cputime_expires)) {
> > - struct task_cputime group_sample;
> > -
> > - thread_group_cputimer(tsk, &group_sample);
> > - if (task_cputime_expired(&group_sample, &sig->cputime_expires))
> > - return 1;
> > - }
> > + if (!task_cputime_zero(&sig->cputime_expires))
> > + return 1;
> >
> > return sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY;
> > }
> >
> > Or stay with task_cputime_expired() but only if cputimer is currently running.
>
> Oh. I forgot this code completely, can't comment.
>
> Can't we ensure that fastpath_timer_check() never do while_each_thread() ?

Removing possibility to call while_each_tread() from fastpath_timer_check()
was exactly my intension here, perhaps I was not clear.

> IOW, if sig->cputime_expires != 0 then ->running must be true.
> At least, shouldn't stop_process_timers() clear sig->cputime_expires ?

I'm going to think about that. However as far seems, checking ->running
explicitly and goto slow patch when is not true is safer solution.

Stanislaw


\
 
 \ /
  Last update: 2009-11-10 19:29    [W:0.064 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site