Re: [PATCH 4/4] posix-timers: turn it_signal into it_valid flag

From: Thomas Gleixner
Date: Tue Sep 06 2011 - 16:10:24 EST


On Tue, 6 Sep 2011, Eric Dumazet wrote:
> Le mardi 06 septembre 2011 Ã 21:16 +0200, Thomas Gleixner a Ãcrit :
> > On Tue, 6 Sep 2011, Oleg Nesterov wrote:
> > Right, but we can solve this by moving the whole detach code into rcu.
> >
>
> Why ? Is the dequeue thing guaranteed in the rcu grace period ?

No, as Oleg pointed out we need an rcu_read_lock() in dequeue_signal()

> ALso, delaying the idr_remove() probably makes next Andi patch more
> complex (move global timer id management to signal_struct)
>
> struct k_itimer will need a backpointer to signal_struct, and an
> additional refcount on it.

Well, first of all we need that problem at hand to be fixed.

And the backpointer is not rocket science at all.

--- linux-2.6.orig/include/linux/posix-timers.h
+++ linux-2.6/include/linux/posix-timers.h
@@ -82,7 +82,10 @@ struct k_itimer {
unsigned long expires;
} mmtimer;
struct alarm alarmtimer;
- struct rcu_head rcu;
+ struct {
+ struct rcu_head rcu;
+ struct signal_struct *it_signal;
+ } rcu;
} it;
};

Solves that nicely and we still can get rid of the original *it_signal
and rely on the list_head.

Vs. the refcounting, that should be solvable by a rcu_barrier() before

+ idr_destroy(&sig->posix_timers_id);

in exit_itimers().

Thanks,

tglx