aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/accounting/delay-accounting.txt13
-rw-r--r--Documentation/accounting/taskstats.txt33
2 files changed, 17 insertions, 29 deletions
diff --git a/Documentation/accounting/delay-accounting.txt b/Documentation/accounting/delay-accounting.txt
index f3dc0ca04fa4..be215e58423b 100644
--- a/Documentation/accounting/delay-accounting.txt
+++ b/Documentation/accounting/delay-accounting.txt
@@ -48,9 +48,10 @@ counter (say cpu_delay_total) for a task will give the delay
48experienced by the task waiting for the corresponding resource 48experienced by the task waiting for the corresponding resource
49in that interval. 49in that interval.
50 50
51When a task exits, records containing the per-task and per-process statistics 51When a task exits, records containing the per-task statistics
52are sent to userspace without requiring a command. More details are given in 52are sent to userspace without requiring a command. If it is the last exiting
53the taskstats interface description. 53task of a thread group, the per-tgid statistics are also sent. More details
54are given in the taskstats interface description.
54 55
55The getdelays.c userspace utility in this directory allows simple commands to 56The getdelays.c userspace utility in this directory allows simple commands to
56be run and the corresponding delay statistics to be displayed. It also serves 57be run and the corresponding delay statistics to be displayed. It also serves
@@ -107,9 +108,3 @@ IO count delay total
107 0 0 108 0 0
108MEM count delay total 109MEM count delay total
109 0 0 110 0 0
110
111
112
113
114
115
diff --git a/Documentation/accounting/taskstats.txt b/Documentation/accounting/taskstats.txt
index acc6b4f37fc7..efd8f605bcd5 100644
--- a/Documentation/accounting/taskstats.txt
+++ b/Documentation/accounting/taskstats.txt
@@ -32,12 +32,11 @@ The response contains statistics for a task (if pid is specified) or the sum of
32statistics for all tasks of the process (if tgid is specified). 32statistics for all tasks of the process (if tgid is specified).
33 33
34To obtain statistics for tasks which are exiting, userspace opens a multicast 34To obtain statistics for tasks which are exiting, userspace opens a multicast
35netlink socket. Each time a task exits, two records are sent by the kernel to 35netlink socket. Each time a task exits, its per-pid statistics is always sent
36each listener on the multicast socket. The first the per-pid task's statistics 36by the kernel to each listener on the multicast socket. In addition, if it is
37and the second is the sum for all tasks of the process to which the task 37the last thread exiting its thread group, an additional record containing the
38belongs (the task does not need to be the thread group leader). The need for 38per-tgid stats are also sent. The latter contains the sum of per-pid stats for
39per-tgid stats to be sent for each exiting task is explained in the per-tgid 39all threads in the thread group, both past and present.
40stats section below.
41 40
42getdelays.c is a simple utility demonstrating usage of the taskstats interface 41getdelays.c is a simple utility demonstrating usage of the taskstats interface
43for reporting delay accounting statistics. 42for reporting delay accounting statistics.
@@ -104,20 +103,14 @@ stats in userspace alone is inefficient and potentially inaccurate (due to lack
104of atomicity). 103of atomicity).
105 104
106However, maintaining per-process, in addition to per-task stats, within the 105However, maintaining per-process, in addition to per-task stats, within the
107kernel has space and time overheads. Hence the taskstats implementation 106kernel has space and time overheads. To address this, the taskstats code
108dynamically sums up the per-task stats for each task belonging to a process 107accumalates each exiting task's statistics into a process-wide data structure.
109whenever per-process stats are needed. 108When the last task of a process exits, the process level data accumalated also
110 109gets sent to userspace (along with the per-task data).
111Not maintaining per-tgid stats creates a problem when userspace is interested 110
112in getting these stats when the process dies i.e. the last thread of 111When a user queries to get per-tgid data, the sum of all other live threads in
113a process exits. It isn't possible to simply return some aggregated per-process 112the group is added up and added to the accumalated total for previously exited
114statistic from the kernel. 113threads of the same thread group.
115
116The approach taken by taskstats is to return the per-tgid stats *each* time
117a task exits, in addition to the per-pid stats for that task. Userspace can
118maintain task<->process mappings and use them to maintain the per-process stats
119in userspace, updating the aggregate appropriately as the tasks of a process
120exit.
121 114
122Extending taskstats 115Extending taskstats
123------------------- 116-------------------