23 Dec, 2010
1 commit
-
The taskstats structure is internally aligned on 8 byte boundaries but the
layout of the aggregrate reply, with two NLA headers and the pid (each 4
bytes), actually force the entire structure to be unaligned. This causes
the kernel to issue unaligned access warnings on some architectures like
ia64. Unfortunately, some software out there doesn't properly unroll the
NLA packet and assumes that the start of the taskstats structure will
always be 20 bytes from the start of the netlink payload. Aligning the
start of the taskstats structure breaks this software, which we don't
want. So, for now the alignment only happens on architectures that
require it and those users will have to update to fixed versions of those
packages. Space is reserved in the packet only when needed. This ifdef
should be removed in several years e.g. 2012 once we can be confident
that fixed versions are installed on most systems. We add the padding
before the aggregate since the aggregate is already a defined type.Commit 85893120 ("delayacct: align to 8 byte boundary on 64-bit systems")
previously addressed the alignment issues by padding out the pid field.
This was supposed to be a compatible change but the circumstances
described above mean that it wasn't. This patch backs out that change,
since it was a hack, and introduces a new NULL attribute type to provide
the padding. Padding the response with 4 bytes avoids allocating an
aligned taskstats structure and copying it back. Since the structure
weighs in at 328 bytes, it's too big to do it on the stack.Signed-off-by: Jeff Mahoney
Reported-by: Brian Rogers
Cc: Jeff Mahoney
Cc: Guillaume Chazarain
Cc: Balbir Singh
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
31 Jan, 2009
1 commit
-
fix the following 'make headers_check' warning:
usr/include/linux/taskstats.h:44: found __[us]{8,16,32,64} type without #include
Signed-off-by: Jaswinder Singh Rajput
26 Jul, 2008
1 commit
-
Add members for memory reclaim delay to taskstats, and accumulate them in
__delayacct_add_tsk() .Signed-off-by: Keika Kobayashi
Cc: Hiroshi Shimamoto
Cc: Balbir Singh
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
19 Oct, 2007
2 commits
-
This moves the new items to the end of the taskstats struct as
requested by Balbir and yourself.Cc: Balbir Singh
Cc: Jay Lan
Cc: Paul Mackerras
Cc: Benjamin Herrenschmidt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This adds items to the taststats struct to account for user and system
time based on scaling the CPU frequency and instruction issue rates.Adds account_(user|system)_time_scaled callbacks which architectures
can use to account for time using this mechanism.Signed-off-by: Michael Neuling
Cc: Balbir Singh
Cc: Jay Lan
Cc: Paul Mackerras
Cc: Benjamin Herrenschmidt
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
17 Jul, 2007
1 commit
-
Make available to the user the following task and process performance
statistics:* Involuntary Context Switches (task_struct->nivcsw)
* Voluntary Context Switches (task_struct->nvcsw)Statistics information is available from:
1. taskstats interface (Documentation/accounting/)
2. /proc/PID/status (task only).This data is useful for detecting hyperactivity patterns between processes.
[akpm@linux-foundation.org: cleanup]
Signed-off-by: Maxim Uvarov
Cc: Shailabh Nagar
Cc: Balbir Singh
Cc: Jay Lan
Cc: Jonathan Lim
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
24 Apr, 2007
1 commit
-
We broke the the alignment of members of taskstats to the 8 byte boundary
with the CSA patches. In the current kernel, the taskstats structure is
not suitable for use by 32 bit applications in a 64 bit kernel.On x86_64
Offsets of taskstats' members (64 bit kernel, 64 bit application)
@taskstats'offsetof[@taskstats'indices] = (
0, # version
4, # ac_exitcode
8, # ac_flag
9, # ac_nice
16, # cpu_count
24, # cpu_delay_total
32, # blkio_count
40, # blkio_delay_total
48, # swapin_count
56, # swapin_delay_total
64, # cpu_run_real_total
72, # cpu_run_virtual_total
80, # ac_comm
112, # ac_sched
113, # ac_pad
116, # ac_uid
120, # ac_gid
124, # ac_pid
128, # ac_ppid
132, # ac_btime
136, # ac_etime
144, # ac_utime
152, # ac_stime
160, # ac_minflt
168, # ac_majflt
176, # coremem
184, # virtmem
192, # hiwater_rss
200, # hiwater_vm
208, # read_char
216, # write_char
224, # read_syscalls
232, # write_syscalls
240, # read_bytes
248, # write_bytes
256, # cancelled_write_bytes
);Offsets of taskstats' members (64 bit kernel, 32 bit application)
@taskstats'offsetof[@taskstats'indices] = (
0, # version
4, # ac_exitcode
8, # ac_flag
9, # ac_nice
12, # cpu_count
20, # cpu_delay_total
28, # blkio_count
36, # blkio_delay_total
44, # swapin_count
52, # swapin_delay_total
60, # cpu_run_real_total
68, # cpu_run_virtual_total
76, # ac_comm
108, # ac_sched
109, # ac_pad
112, # ac_uid
116, # ac_gid
120, # ac_pid
124, # ac_ppid
128, # ac_btime
132, # ac_etime
140, # ac_utime
148, # ac_stime
156, # ac_minflt
164, # ac_majflt
172, # coremem
180, # virtmem
188, # hiwater_rss
196, # hiwater_vm
204, # read_char
212, # write_char
220, # read_syscalls
228, # write_syscalls
236, # read_bytes
244, # write_bytes
252, # cancelled_write_bytes
);This is one way to solve the problem without re-arranging structure members
is to pack the structure. The patch adds an __attribute__((aligned(8))) to
the taskstats structure members so that 32 bit applications using taskstats
can work with a 64 bit kernel.Using __attribute__((packed)) would break the 64 bit alignment of members.
The fix was tested on x86_64. After the fix, we got
Offsets of taskstats' members (64 bit kernel, 64 bit application)
@taskstats'offsetof[@taskstats'indices] = (
0, # version
4, # ac_exitcode
8, # ac_flag
9, # ac_nice
16, # cpu_count
24, # cpu_delay_total
32, # blkio_count
40, # blkio_delay_total
48, # swapin_count
56, # swapin_delay_total
64, # cpu_run_real_total
72, # cpu_run_virtual_total
80, # ac_comm
112, # ac_sched
113, # ac_pad
120, # ac_uid
124, # ac_gid
128, # ac_pid
132, # ac_ppid
136, # ac_btime
144, # ac_etime
152, # ac_utime
160, # ac_stime
168, # ac_minflt
176, # ac_majflt
184, # coremem
192, # virtmem
200, # hiwater_rss
208, # hiwater_vm
216, # read_char
224, # write_char
232, # read_syscalls
240, # write_syscalls
248, # read_bytes
256, # write_bytes
264, # cancelled_write_bytes
);Offsets of taskstats' members (64 bit kernel, 32 bit application)
@taskstats'offsetof[@taskstats'indices] = (
0, # version
4, # ac_exitcode
8, # ac_flag
9, # ac_nice
16, # cpu_count
24, # cpu_delay_total
32, # blkio_count
40, # blkio_delay_total
48, # swapin_count
56, # swapin_delay_total
64, # cpu_run_real_total
72, # cpu_run_virtual_total
80, # ac_comm
112, # ac_sched
113, # ac_pad
120, # ac_uid
124, # ac_gid
128, # ac_pid
132, # ac_ppid
136, # ac_btime
144, # ac_etime
152, # ac_utime
160, # ac_stime
168, # ac_minflt
176, # ac_majflt
184, # coremem
192, # virtmem
200, # hiwater_rss
208, # hiwater_vm
216, # read_char
224, # write_char
232, # read_syscalls
240, # write_syscalls
248, # read_bytes
256, # write_bytes
264, # cancelled_write_bytes
);Signed-off-by: Balbir Singh
Cc: Jay Lan
Cc: Shailabh Nagar
Cc:
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
11 Dec, 2006
2 commits
-
Deliver IO accounting via taskstats.
Cc: Jay Lan
Cc: Shailabh Nagar
Cc: Balbir Singh
Cc: Chris Sturtivant
Cc: Tony Ernst
Cc: Guillaume Thouvenin
Cc: David Wright
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Fix weird whitespace mangling in taskstats.h
Cc: Jay Lan
Cc: Shailabh Nagar
Cc: Balbir Singh
Cc: Chris Sturtivant
Cc: Tony Ernst
Cc: Guillaume Thouvenin
Cc: David Wright
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
01 Oct, 2006
3 commits
-
ChangeLog:
Feedbacks from Andrew Morton:
- define TS_COMM_LEN to 32
- change acct_stimexpd field of task_struct to be of
cputime_t, which is to be used to save the tsk->stime
of last timer interrupt update.
- a new Documentation/accounting/taskstats-struct.txt
to describe fields of taskstats struct.Feedback from Balbir Singh:
- keep the stime of a task to be zero when both stime
and utime are zero as recoreded in task_struct.Misc:
- convert accumulated RSS/VM from platform dependent
pages-ticks to MBytes-usecs in the kernelCc: Shailabh Nagar
Cc: Balbir Singh
Cc: Jes Sorensen
Cc: Chris Sturtivant
Cc: Tony Ernst
Cc: Guillaume Thouvenin
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add extended system accounting handling over taskstats interface. A
CONFIG_TASK_XACCT flag is created to enable the extended accounting code.Signed-off-by: Jay Lan
Cc: Shailabh Nagar
Cc: Balbir Singh
Cc: Jes Sorensen
Cc: Chris Sturtivant
Cc: Tony Ernst
Cc: Guillaume Thouvenin
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Add some basic accounting fields to the taskstats struct, add a new
kernel/tsacct.c to handle basic accounting data handling upon exit. A handle
is added to taskstats.c to invoke the basic accounting data handling.Signed-off-by: Jay Lan
Cc: Shailabh Nagar
Cc: Balbir Singh
Cc: Jes Sorensen
Cc: Chris Sturtivant
Cc: Tony Ernst
Cc: Guillaume Thouvenin
Cc: "Michal Piotrowski"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
15 Jul, 2006
3 commits
-
On systems with a large number of cpus, with even a modest rate of tasks
exiting per cpu, the volume of taskstats data sent on thread exit can
overflow a userspace listener's buffers.One approach to avoiding overflow is to allow listeners to get data for a
limited and specific set of cpus. By scaling the number of listeners
and/or the cpus they monitor, userspace can handle the statistical data
overload more gracefully.In this patch, each listener registers to listen to a specific set of cpus
by specifying a cpumask. The interest is recorded per-cpu. When a task
exits on a cpu, its taskstats data is unicast to each listener interested
in that cpu.Thanks to Andrew Morton for pointing out the various scalability and
general concerns of previous attempts and for suggesting this design.[akpm@osdl.org: build fix]
Signed-off-by: Shailabh Nagar
Signed-off-by: Balbir Singh
Signed-off-by: Chandra Seetharaman
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Usage of taskstats interface by delay accounting.
Signed-off-by: Shailabh Nagar
Signed-off-by: Balbir Singh
Cc: Jes Sorensen
Cc: Peter Chubb
Cc: Erich Focht
Cc: Levent Serinol
Cc: Jay Lan
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Create a "taskstats" interface based on generic netlink (NETLINK_GENERIC
family), for getting statistics of tasks and thread groups during their
lifetime and when they exit. The interface is intended for use by multiple
accounting packages though it is being created in the context of delay
accounting.This patch creates the interface without populating the fields of the data
that is sent to the user in response to a command or upon the exit of a task.
Each accounting package interested in using taskstats has to provide an
additional patch to add its stats to the common structure.[akpm@osdl.org: cleanups, Kconfig fix]
Signed-off-by: Shailabh Nagar
Signed-off-by: Balbir Singh
Cc: Jes Sorensen
Cc: Peter Chubb
Cc: Erich Focht
Cc: Levent Serinol
Cc: Jay Lan
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds