Re: posix-cpu-timers revamp

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Roland McGrath
Date: Tuesday, April 8, 2008 - 3:49 pm

My explanation about the constraints on exit_state was specifically about
the context of update_process_times(), which is part of the path for a
clock tick interrupting current.


The scheduler code has gotten a lot more complex since I first implemented
posix-cpu-timers, and I've never been any expert on the scheduler at all.
But I'm moderately sure all those things are all involved in context
switch where the task of interest is about to be on a CPU or just was on a
CPU.  I doubt those are places where the task in question could be
simultaneously executing in exit_notify() on another CPU.  But we'd need
to ask the scheduler experts to be sure we know what we're talking about
there.


I haven't figured out what actual code path this refers to.


This sort of concern is among the reasons that checking ->signal was the
course I found wise to suggest to begin with.  We can figure out what the
constraints on ->exit_state are in all the places by understanding every
corner of the scheduler.  We can measure whether it winds up being in a
cooler cache line than ->signal and a net loss to add the load, or has
superior performance as you seem to think.  Or we can just test the
constraint that matters, whether the pointer we loaded was in fact null,
and rely on RCU to make it not matter if there is a race after that load.
It doesn't matter whether tsk is current or not, it only matters that we
have the pointer and that we're using some CPU array slot or other that
noone else is using simultaneously.

    static inline void account_group_exec_runtime(struct task_struct *tsk,
						  unsigned long long runtime)
    {
	    struct signal_struct *sig;
	    struct task_cputime *times;

	    rcu_read_lock();
	    sig = rcu_dereference(tsk->signal);
	    if (likely(sig) && sig->cputime.totals) {
		    times = per_cpu_ptr(sig->cputime.totals, get_cpu());
		    times->sum_exec_runtime += runtime;
		    put_cpu_no_resched();
	    }
	    rcu_read_unlock();
    }


Thanks,
Roland
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [Bugme-new] [Bug 9906] New: Weird hang with NPTL and S ..., Alejandro Riveira , (Thu Feb 7, 8:22 am)
Re: [Bugme-new] [Bug 9906] New: Weird hang with NPTL and S ..., Alejandro Riveira , (Thu Feb 7, 8:54 am)
posix-cpu-timers revamp, Roland McGrath, (Tue Mar 11, 12:50 am)
Re: posix-cpu-timers revamp, Frank Mayhar, (Tue Mar 11, 2:05 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Tue Mar 11, 2:35 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Thu Mar 13, 5:37 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Fri Mar 21, 12:18 am)
Re: posix-cpu-timers revamp, Frank Mayhar, (Fri Mar 21, 10:57 am)
Re: posix-cpu-timers revamp, Frank Mayhar, (Fri Mar 21, 1:40 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Sat Mar 22, 2:58 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Mon Mar 24, 10:34 am)
Re: posix-cpu-timers revamp, Frank Mayhar, (Mon Mar 24, 3:43 pm)
[PATCH 2.6.25-rc6] Fix itimer/many thread hang., Frank Mayhar, (Thu Mar 27, 5:52 pm)
Re: [PATCH 2.6.25-rc6] Fix itimer/many thread hang., Ingo Molnar, (Fri Mar 28, 3:28 am)
Re: posix-cpu-timers revamp, Roland McGrath, (Sun Mar 30, 10:44 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Mon Mar 31, 1:24 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Tue Apr 1, 7:07 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Wed Apr 2, 9:34 am)
Re: posix-cpu-timers revamp, Frank Mayhar, (Wed Apr 2, 10:42 am)
Re: posix-cpu-timers revamp, Frank Mayhar, (Wed Apr 2, 11:42 am)
Re: posix-cpu-timers revamp, Roland McGrath, (Wed Apr 2, 12:48 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Wed Apr 2, 1:34 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Wed Apr 2, 2:42 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Thu Apr 3, 5:53 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Fri Apr 4, 4:17 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Sat Apr 5, 10:26 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Mon Apr 7, 1:08 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Mon Apr 7, 2:31 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Mon Apr 7, 3:02 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Tue Apr 8, 2:27 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Tue Apr 8, 2:52 pm)
Re: posix-cpu-timers revamp, Roland McGrath, (Tue Apr 8, 3:49 pm)
Re: posix-cpu-timers revamp, Frank Mayhar, (Wed Apr 9, 9:29 am)