Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932132AbcDKXiQ (ORCPT ); Mon, 11 Apr 2016 19:38:16 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36820 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755436AbcDKXgY (ORCPT ); Mon, 11 Apr 2016 19:36:24 -0400 From: Andrey Vagin To: linux-kernel@vger.kernel.org Cc: Andrey Vagin , Oleg Nesterov , Andrew Morton , Cyrill Gorcunov , Pavel Emelyanov , Roger Luethi , Arnd Bergmann , Arnaldo Carvalho de Melo , David Ahern , Andy Lutomirski , Pavel Odintsov Subject: [PATCH 12/15] Documentation: add documentation for task_diag Date: Mon, 11 Apr 2016 16:35:52 -0700 Message-Id: <1460417755-18201-13-git-send-email-avagin@openvz.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1460417755-18201-1-git-send-email-avagin@openvz.org> References: <1460417755-18201-1-git-send-email-avagin@openvz.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2358 Lines: 71 Signed-off-by: Andrey Vagin --- Documentation/accounting/task_diag.txt | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/accounting/task_diag.txt diff --git a/Documentation/accounting/task_diag.txt b/Documentation/accounting/task_diag.txt new file mode 100644 index 0000000..ff486b9 --- /dev/null +++ b/Documentation/accounting/task_diag.txt @@ -0,0 +1,57 @@ +The task-diag interface allows to get information about running processes +(roughly same info that is now available from /proc/PID/* files). Compared to +/proc/PID/* files, it is faster, more flexible and provides data in a binary +format. Task-diag was created using the basic idea of socket_diag. + +Interface +--------- + +Here is the /proc/task-diag file, which operates based on the following +principles: + +* Transactional: write request, read response +* Netlink message format (same as used by sock_diag; binary and extendable) + +The user-kernel interface is encapsulated in include/uapi/linux/task_diag.h + +Request +------- + +A request is described by the task_diag_pid structure. + +struct task_diag_pid { + __u64 show_flags; /* TASK_DIAG_SHOW_* */ + __u64 dump_stratagy; /* TASK_DIAG_DUMP_* */ + + __u32 pid; +}; + +dump_stratagy specifies a group of processes: +/* per-process strategies */ +TASK_DIAG_DUMP_CHILDREN - all children +TASK_DIAG_DUMP_THREAD - all threads +TASK_DIAG_DUMP_ONE - one process +/* system wide strategies (the pid fiel is ignored) */ +TASK_DIAG_DUMP_ALL - all processes +TASK_DIAG_DUMP_ALL_THREAD - all threads + +show_flags specifies which information are required. If we set the +TASK_DIAG_SHOW_BASE flag, the response message will contain the TASK_DIAG_BASE +attribute which is described by the task_diag_base structure. + +In future, it can be extended by optional attributes. The request describes +which task properties are required and for which processes they are required +for. + +Response +-------- + +A response can be divided into a few packets. Each task is described by a +netlink message. If all information about a process doesn't fit into a message, +the TASK_DIAG_FLAG_CONT flag will be set and the next message will continue +describing the same process. + +Examples +-------- + +A few examples can be found in tools/testing/selftests/task_diag/ -- 2.5.5