statedump: introduce file_table_address
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 10 Mar 2020 19:00:29 +0000 (15:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 10 Mar 2020 19:12:08 +0000 (15:12 -0400)
commite7a0ca7205fd4be7c829d171baa8823fe4784c90
tree4ed392a3853f56b4539fbb5eb22dcd29510ec079
parent6314c2d3a4ad617f5f122083a7fda007d4319b92
statedump: introduce file_table_address

Currently the LTTng-modules statedump simply iterates over all processes
in the system and assumes all threads share the same file descriptor
table, which is only true if threads were created with clone
CLONE_FILES.

Directly invoking clone without the CLONE_FILES creates threads which
belong to the same process, but have their own file descriptor table.

Therefore, model-wise, we cannot assume that all threads in a process
have the same fd table content.

Add a new "file_table_address" field to the lttng_statedump_process_state
event, which dumps the address of the thread's struct files_struct
pointer. This pointer is guaranteed to never be re-used while we hold
the RCU read-side lock (so for the entire iteration over
processes/threads).

For the lttng_statedump_file_descriptor event, remove the "pid" field
(which is semantically inaccurate) and add a "file_table_address" field,
which contains the struct files_struct address of the file table
containing the file descriptor.

An optimization is performed to eliminate most duplcated file table
content by skipping file table dump if the same file table address is
encountered consecutively while iterating over a process' threads.

This introduces a semantic change to the statedump fields, and will
therefore be introduced in lttng-modules 2.12 onwards, not backported as
a fix.

Fixes: #1245
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/lttng-statedump.h
lttng-statedump-impl.c
This page took 0.02547 seconds and 4 git commands to generate.