login
Header Space

 
 

Re: posix-cpu-timers revamp

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Roland McGrath <roland@...>
Cc: <linux-kernel@...>
Date: Thursday, April 3, 2008 - 8:53 pm

On Wed, 2008-04-02 at 14:42 -0700, Frank Mayhar wrote:

Okay, having run face-first into this race and having every combination
of spinlock serialization fail for me, I've done a variation of the
above scheme.

For the local environment, I solved the problem by moving the percpu
structure out of the signal structure entirely and by making it
refcounted.  It is allocated as before, but now in two parts, a normal
structure with an atomic refcount that has a pointer to the percpu
structure.  The signal structure doesn't point to it any longer, but
each task_struct in the thread group does, and each of these references
is counted.  New threads will also get a reference (at the top of
copy_signal()) and be counted.  All access goes through the task
structure.  References are removed in __put_task_struct() when the task
itself is destroyed; when the last reference goes away, the structures
are freed.

This eliminates the races with signal_struct being freed and has the
nice effect that there is a bit less overhead in places like
account_group_user_time() and friends.  In run_posix_cpu_timers(),
though, I have to pick up the tasklist_lock early (and therefore in
every case) because it's still dereferencing tsk->signal in the early
comparison.

I'm thinking about moving all of the itimer stuff (i.e. the
cputime_expires structures) into the refcounted structure as well, thus
avoiding the signal_struct entirely so we don't need the tasklist_lock
in the fast path.  I don't know how any of this will affect the UP case,
though.  I'll have to continue to think about it and I'm sure you have
something to say as well.  (And if anyone else wants to chime in,
they're welcome.)
-- 
Frank Mayhar <fmayhar@google.com>
Google, Inc.

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