From: Jérémie Galarneau Date: Fri, 6 Jul 2018 02:43:33 +0000 (-0400) Subject: fd-tracker: add an optimization note to the fd-tracker X-Git-Url: http://git.efficios.com/?p=deliverable%2Flttng-tools.git;a=commitdiff_plain;h=97c34b3071a2a88e089f3123f01865b6e4d07fdd fd-tracker: add an optimization note to the fd-tracker Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/fd-tracker/fd-tracker.c b/src/common/fd-tracker/fd-tracker.c index 2f743be94..e26ff2185 100644 --- a/src/common/fd-tracker/fd-tracker.c +++ b/src/common/fd-tracker/fd-tracker.c @@ -754,6 +754,17 @@ int fs_handle_get_fd(struct fs_handle *handle) { int ret; + /* + * TODO This should be optimized as it is a fairly hot path. + * The fd-tracker's lock should only be taken when a fs_handle is + * restored (slow path). On the fast path (fs_handle is active), + * the only effect on the fd_tracker is marking the handle as the + * most recently used. Currently, it is done by a call to the + * track/untrack helpers, but it should be done atomically. + * + * Note that the lock's nesting order must still be respected here. + * The handle's lock nests inside the tracker's lock. + */ pthread_mutex_lock(&handle->tracker->lock); pthread_mutex_lock(&handle->lock); assert(!handle->in_use);