[PATCH 6/6] get_utrace_lock: do not check EXIT_DEAD

Roland McGrath roland at redhat.com
Sun Aug 2 00:44:12 UTC 2009


> get_utrace_lock() checks ->state != EXIT_DEAD to make sure it safe
> to use ->utrace. This is unneeded since ->utrace was embedded into
> task_struct. If we can read ->state, we can read ->utrace as well.

I see.  My immediate reaction to this was that it should have more comments
that make clear it's relying on that rule of struct utrace lifetime.  That
thought was motivated by my interest in changing the data structure (again)
to using a struct utrace pointer in the future.  But the reason that it's
potentially worthwhile to have a pointer that can go away is to reclaim the
memory on live detach.  Even if we do go that way again, we won't
reintroduce the same kind of race with utrace_release_task, because it's
far simpler just to delay the deallocation until tracehook_free_task.  So
whatever magic we would need in get_utrace_lock would be worrying only
about interlocks with utrace_reset, not with ->exit_state changes.  i.e.
it is orthogonal to this change.


Thanks,
Roland




More information about the utrace-devel mailing list