[ltt-dev] [UST PATCH] libust: Add locking around fork calls
Mathieu Desnoyers
compudj at krystal.dyndns.org
Thu Mar 3 11:55:55 EST 2011
* Mathieu Desnoyers (compudj at krystal.dyndns.org) wrote:
> * Nils Carlson (nils.carlson at ericsson.com) wrote:
> > On Thu, 24 Feb 2011, Nils Carlson wrote:
> >
> >> A finer scheme could be implemented by using system V semaphores
> >> and could look like this:
> >>
> >> thread executing tracectl command:
> >> lock(fork_sem_mutex)
> >> increment(fork_sem)
> >> unlock(fork_sem_mutex)
> >> execute_command()
> >> decrement(fork_sem)
> >>
> >> thread executing fork:
> >> lock(fork_sem_mutex) // now no new commands can be issued
> >> wait(fork_sem == 0) // wait for all commands to finish
> >> fork()
> >> unlock(fork_sem_mutex) // let commands start again.
> >>
> >> I think this would work well, but system V semaphores are sort
> >> of heavy. So maybe somebody can come up with something prettier?
> >
> > This could probably be done nicer with a rwlock as well or a cond_wait.
> > I think these alternatives would both be simpler than system v semaphores.
>
BTW, I just commited a fix that address this problem with 2 mutexes. See
changelog for details. It also takes care of making sure urcu-bp is in a
correct state after the fork.
Thanks,
Mathieu
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list