From 1a87d9425e0347c0e880254816d8e9f41a0e2b0c Mon Sep 17 00:00:00 2001 From: Chris Boot Date: Mon, 10 Jul 2006 04:45:34 -0700 Subject: [PATCH] LED Class support for Soekris net48xx Add LED Class device support for the Soekris net48xx Error LED. Tested only on a net4801, but should work on a net4826 as well. I'd love to find a way of detecting a Soekris net48xx device but there is no DMI or any Soekris-specific PCI devices. [akpm@osdl.org: fixlets, cleanups] Signed-off-by: Chris Boot Cc: Ben Dooks Cc: Richard Purdie Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index 196a31c97524..c55f690d4030 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2666,6 +2666,11 @@ M: shemminger@osdl.org L: netdev@vger.kernel.org S: Maintained +SOEKRIS NET48XX LED SUPPORT +P: Chris Boot +M: bootc@bootc.net +S: Maintained + SPARC (sparc32): P: William L. Irwin M: wli@holomorphy.com -- cgit v1.2.3 From 77dac90fe4c3d05917045169ec1e3dbc589c0865 Mon Sep 17 00:00:00 2001 From: Muli Ben-Yehuda Date: Mon, 10 Jul 2006 17:06:12 +0200 Subject: [PATCH] x86_64: Add a MAINTAINERS entry for Calgary Signed-off-by: Muli Ben-Yehuda Signed-off-by: Jon Mason Signed-off-by: Andi Kleen Signed-off-by: Linus Torvalds --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index c55f690d4030..645a9f85f33f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -601,6 +601,15 @@ W: http://linuxtv.org T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git S: Maintained +CALGARY x86-64 IOMMU +P: Muli Ben-Yehuda +M: muli@il.ibm.com +P: Jon D. Mason +M: jdmason@us.ibm.com +L: linux-kernel@vger.kernel.org +L: discuss@x86-64.org +S: Maintained + COMMON INTERNET FILE SYSTEM (CIFS) P: Steve French M: sfrench@samba.org -- cgit v1.2.3 From 781b456a980ec987a4be248f236c59658f651240 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 10 Jul 2006 20:25:29 -0700 Subject: [MAINTAINERS]: Add proper entry for TC classifier Acked-by: Jamal Hadi Salim Signed-off-by: David S. Miller --- MAINTAINERS | 6 ++++++ net/sched/act_api.c | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index 645a9f85f33f..ec8846f58f63 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2752,6 +2752,12 @@ P: Christoph Hellwig M: hch@infradead.org S: Maintained +TC CLASSIFIER +P: Jamal Hadi Salim +M: hadi@cyberus.ca +L: netdev@vger.kernel.org +S: Maintained + TI OMAP RANDOM NUMBER GENERATOR SUPPORT P: Deepak Saxena M: dsaxena@plexity.net diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 0972247a839c..9affeeedf107 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -884,8 +884,6 @@ static int __init tc_action_init(void) link_p[RTM_GETACTION-RTM_BASE].dumpit = tc_dump_action; } - printk("TC classifier action (bugs to netdev@vger.kernel.org cc " - "hadi@cyberus.ca)\n"); return 0; } -- cgit v1.2.3 From 4e35dea2f26b16735b242ed1ae876157f46f3b23 Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Mon, 19 Jun 2006 09:59:02 +0400 Subject: [PATCH] W1: remove w1 mail list from lm_sensors. lm_sensors mail list is going to be splitted into separate subdev lists, so remove w1 from there. http://lists.lm-sensors.org/pipermail/lm-sensors/2006-June/016507.html Signed-off-by: Evgeniy Polyakov Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index 645a9f85f33f..491e034f3475 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3180,7 +3180,6 @@ S: Maintained W1 DALLAS'S 1-WIRE BUS P: Evgeniy Polyakov M: johnpol@2ka.mipt.ru -L: lm-sensors@lm-sensors.org S: Maintained W83L51xD SD/MMC CARD INTERFACE DRIVER -- cgit v1.2.3 From 5d925fecac26651e6b0e19cf4ca16933aa640f99 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 1 Jul 2006 17:14:32 +0200 Subject: [PATCH] i2c: New mailing list We have a new mailing list dedicated to linux i2c: http://lists.lm-sensors.org/mailman/listinfo/i2c Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/busses/i2c-sis96x | 4 ++-- MAINTAINERS | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'MAINTAINERS') diff --git a/Documentation/i2c/busses/i2c-sis96x b/Documentation/i2c/busses/i2c-sis96x index 00a009b977e9..08d7b2dac69a 100644 --- a/Documentation/i2c/busses/i2c-sis96x +++ b/Documentation/i2c/busses/i2c-sis96x @@ -42,8 +42,8 @@ I suspect that this driver could be made to work for the following SiS chipsets as well: 635, and 635T. If anyone owns a board with those chips AND is willing to risk crashing & burning an otherwise well-behaved kernel in the name of progress... please contact me at or -via the project's mailing list: . Please -send bug reports and/or success stories as well. +via the project's mailing list: . Please send bug +reports and/or success stories as well. TO DOs diff --git a/MAINTAINERS b/MAINTAINERS index 645a9f85f33f..669939429daa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -274,7 +274,7 @@ S: Maintained ALI1563 I2C DRIVER P: Rudolf Marek M: r.marek@sh.cvut.cz -L: lm-sensors@lm-sensors.org +L: i2c@lm-sensors.org S: Maintained ALPHA PORT @@ -1249,7 +1249,7 @@ S: Maintained I2C SUBSYSTEM P: Jean Delvare M: khali@linux-fr.org -L: lm-sensors@lm-sensors.org +L: i2c@lm-sensors.org W: http://www.lm-sensors.nu/ T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ S: Maintained @@ -2093,7 +2093,7 @@ S: Maintained OPENCORES I2C BUS DRIVER P: Peter Korsgaard M: jacmet@sunsite.dk -L: lm-sensors@lm-sensors.org +L: i2c@lm-sensors.org S: Maintained ORACLE CLUSTER FILESYSTEM 2 (OCFS2) @@ -3132,7 +3132,7 @@ S: Maintained VIAPRO SMBUS DRIVER P: Jean Delvare M: khali@linux-fr.org -L: lm-sensors@lm-sensors.org +L: i2c@lm-sensors.org S: Maintained UCLINUX (AND M68KNOMMU) -- cgit v1.2.3 From 1392707977de9e0df18123d56c3148cb0b1c6ab5 Mon Sep 17 00:00:00 2001 From: Charles Spirakis Date: Wed, 5 Jul 2006 18:05:15 +0200 Subject: [PATCH] hwmon: New maintainer for w83791d Add Charles Spirakis as the maintainer for the w83791d sensor chip driver. Signed-off-by: Charles Spirakis Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index 669939429daa..d4bc2939fd14 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3183,6 +3183,12 @@ M: johnpol@2ka.mipt.ru L: lm-sensors@lm-sensors.org S: Maintained +W83791D HARDWARE MONITORING DRIVER +P: Charles Spirakis +M: bezaur@gmail.com +L: lm-sensors@lm-sensors.org +S: Maintained + W83L51xD SD/MMC CARD INTERFACE DRIVER P: Pierre Ossman M: drzeus-wbsd@drzeus.cx -- cgit v1.2.3 From f5df5881e2a2ff2be62608de1a156ac6d2352fc2 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 14 Jul 2006 00:24:29 -0700 Subject: [PATCH] actual mailing list in MAINTAINERS Add actual mailing list email addresses for the 4 that were only listing a web page. Signed-off-by: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'MAINTAINERS') diff --git a/MAINTAINERS b/MAINTAINERS index a3462c3414cd..0557cfde053d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -771,6 +771,7 @@ M: aliakc@web.de P: Jamie Lenehan M: lenehan@twibble.org W: http://twibble.org/dist/dc395x/ +L: dc395x@twibble.org L: http://lists.twibble.org/mailman/listinfo/dc395x/ S: Maintained @@ -1501,6 +1502,7 @@ P: Yi Zhu M: yi.zhu@intel.com P: James Ketrenos M: jketreno@linux.intel.com +L: ipw2100-devel@lists.sourceforge.net L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel W: http://ipw2100.sourceforge.net S: Supported @@ -1510,6 +1512,7 @@ P: Yi Zhu M: yi.zhu@intel.com P: James Ketrenos M: jketreno@linux.intel.com +L: ipw2100-devel@lists.sourceforge.net L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel W: http://ipw2200.sourceforge.net S: Supported @@ -2226,6 +2229,7 @@ S: Maintained PCMCIA SUBSYSTEM P: Linux PCMCIA Team +L: linux-pcmcia@lists.infradead.org L: http://lists.infradead.org/mailman/listinfo/linux-pcmcia T: git kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git S: Maintained -- cgit v1.2.3 From ad4ecbcba72855a2b5319b96e2a3a65ed1ca3bfd Mon Sep 17 00:00:00 2001 From: Shailabh Nagar Date: Fri, 14 Jul 2006 00:24:44 -0700 Subject: [PATCH] delay accounting taskstats interface send tgid once Send per-tgid data only once during exit of a thread group instead of once with each member thread exit. Currently, when a thread exits, besides its per-tid data, the per-tgid data of its thread group is also sent out, if its thread group is non-empty. The per-tgid data sent consists of the sum of per-tid stats for all *remaining* threads of the thread group. This patch modifies this sending in two ways: - the per-tgid data is sent only when the last thread of a thread group exits. This cuts down heavily on the overhead of sending/receiving per-tgid data, especially when other exploiters of the taskstats interface aren't interested in per-tgid stats - the semantics of the per-tgid data sent are changed. Instead of being the sum of per-tid data for remaining threads, the value now sent is the true total accumalated statistics for all threads that are/were part of the thread group. The patch also addresses a minor issue where failure of one accounting subsystem to fill in the taskstats structure was causing the send of taskstats to not be sent at all. The patch has been tested for stability and run cerberus for over 4 hours on an SMP. [akpm@osdl.org: bugfixes] Signed-off-by: Shailabh Nagar Signed-off-by: Balbir Singh Cc: Jay Lan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Documentation/accounting/delay-accounting.txt | 13 ++-- Documentation/accounting/taskstats.txt | 33 ++++----- MAINTAINERS | 12 ++++ include/linux/sched.h | 4 ++ include/linux/taskstats_kern.h | 71 ++++++++++++++----- kernel/exit.c | 8 +-- kernel/fork.c | 4 ++ kernel/taskstats.c | 98 ++++++++++++++++++--------- 8 files changed, 162 insertions(+), 81 deletions(-) (limited to 'MAINTAINERS') 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 experienced by the task waiting for the corresponding resource in that interval. -When a task exits, records containing the per-task and per-process statistics -are sent to userspace without requiring a command. More details are given in -the taskstats interface description. +When a task exits, records containing the per-task statistics +are sent to userspace without requiring a command. If it is the last exiting +task of a thread group, the per-tgid statistics are also sent. More details +are given in the taskstats interface description. The getdelays.c userspace utility in this directory allows simple commands to be run and the corresponding delay statistics to be displayed. It also serves @@ -107,9 +108,3 @@ IO count delay total 0 0 MEM count delay total 0 0 - - - - - - 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 statistics for all tasks of the process (if tgid is specified). To obtain statistics for tasks which are exiting, userspace opens a multicast -netlink socket. Each time a task exits, two records are sent by the kernel to -each listener on the multicast socket. The first the per-pid task's statistics -and the second is the sum for all tasks of the process to which the task -belongs (the task does not need to be the thread group leader). The need for -per-tgid stats to be sent for each exiting task is explained in the per-tgid -stats section below. +netlink socket. Each time a task exits, its per-pid statistics is always sent +by the kernel to each listener on the multicast socket. In addition, if it is +the last thread exiting its thread group, an additional record containing the +per-tgid stats are also sent. The latter contains the sum of per-pid stats for +all threads in the thread group, both past and present. getdelays.c is a simple utility demonstrating usage of the taskstats interface for reporting delay accounting statistics. @@ -104,20 +103,14 @@ stats in userspace alone is inefficient and potentially inaccurate (due to lack of atomicity). However, maintaining per-process, in addition to per-task stats, within the -kernel has space and time overheads. Hence the taskstats implementation -dynamically sums up the per-task stats for each task belonging to a process -whenever per-process stats are needed. - -Not maintaining per-tgid stats creates a problem when userspace is interested -in getting these stats when the process dies i.e. the last thread of -a process exits. It isn't possible to simply return some aggregated per-process -statistic from the kernel. - -The approach taken by taskstats is to return the per-tgid stats *each* time -a task exits, in addition to the per-pid stats for that task. Userspace can -maintain task<->process mappings and use them to maintain the per-process stats -in userspace, updating the aggregate appropriately as the tasks of a process -exit. +kernel has space and time overheads. To address this, the taskstats code +accumalates each exiting task's statistics into a process-wide data structure. +When the last task of a process exits, the process level data accumalated also +gets sent to userspace (along with the per-task data). + +When a user queries to get per-tgid data, the sum of all other live threads in +the group is added up and added to the accumalated total for previously exited +threads of the same thread group. Extending taskstats ------------------- diff --git a/MAINTAINERS b/MAINTAINERS index 0557cfde053d..e99028ca2f7c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2240,6 +2240,12 @@ M: tsbogend@alpha.franken.de L: netdev@vger.kernel.org S: Maintained +PER-TASK DELAY ACCOUNTING +P: Shailabh Nagar +M: nagar@watson.ibm.com +L: linux-kernel@vger.kernel.org +S: Maintained + PERSONALITY HANDLING P: Christoph Hellwig M: hch@infradead.org @@ -2767,6 +2773,12 @@ P: Deepak Saxena M: dsaxena@plexity.net S: Maintained +TASKSTATS STATISTICS INTERFACE +P: Shailabh Nagar +M: nagar@watson.ibm.com +L: linux-kernel@vger.kernel.org +S: Maintained + TI PARALLEL LINK CABLE DRIVER P: Romain Lievin M: roms@lpg.ticalc.org diff --git a/include/linux/sched.h b/include/linux/sched.h index 3c5610ca0c92..6afa72e080cb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -463,6 +463,10 @@ struct signal_struct { #ifdef CONFIG_BSD_PROCESS_ACCT struct pacct_struct pacct; /* per-process accounting information */ #endif +#ifdef CONFIG_TASKSTATS + spinlock_t stats_lock; + struct taskstats *stats; +#endif }; /* Context switch must be unlocked if interrupts are to be enabled */ diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h index fc9da2e26443..0ae8f67af1fd 100644 --- a/include/linux/taskstats_kern.h +++ b/include/linux/taskstats_kern.h @@ -19,36 +19,75 @@ enum { extern kmem_cache_t *taskstats_cache; extern struct mutex taskstats_exit_mutex; -static inline void taskstats_exit_alloc(struct taskstats **ptidstats, - struct taskstats **ptgidstats) +static inline void taskstats_exit_alloc(struct taskstats **ptidstats) { *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); - *ptgidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); } -static inline void taskstats_exit_free(struct taskstats *tidstats, - struct taskstats *tgidstats) +static inline void taskstats_exit_free(struct taskstats *tidstats) { if (tidstats) kmem_cache_free(taskstats_cache, tidstats); - if (tgidstats) - kmem_cache_free(taskstats_cache, tgidstats); } -extern void taskstats_exit_send(struct task_struct *, struct taskstats *, - struct taskstats *); -extern void taskstats_init_early(void); +static inline void taskstats_tgid_init(struct signal_struct *sig) +{ + spin_lock_init(&sig->stats_lock); + sig->stats = NULL; +} + +static inline void taskstats_tgid_alloc(struct signal_struct *sig) +{ + struct taskstats *stats; + unsigned long flags; + + stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); + if (!stats) + return; + + spin_lock_irqsave(&sig->stats_lock, flags); + if (!sig->stats) { + sig->stats = stats; + stats = NULL; + } + spin_unlock_irqrestore(&sig->stats_lock, flags); + + if (stats) + kmem_cache_free(taskstats_cache, stats); +} +static inline void taskstats_tgid_free(struct signal_struct *sig) +{ + struct taskstats *stats = NULL; + unsigned long flags; + + spin_lock_irqsave(&sig->stats_lock, flags); + if (sig->stats) { + stats = sig->stats; + sig->stats = NULL; + } + spin_unlock_irqrestore(&sig->stats_lock, flags); + if (stats) + kmem_cache_free(taskstats_cache, stats); +} + +extern void taskstats_exit_send(struct task_struct *, struct taskstats *, int); +extern void taskstats_init_early(void); +extern void taskstats_tgid_alloc(struct signal_struct *); #else -static inline void taskstats_exit_alloc(struct taskstats **ptidstats, - struct taskstats **ptgidstats) +static inline void taskstats_exit_alloc(struct taskstats **ptidstats) {} -static inline void taskstats_exit_free(struct taskstats *ptidstats, - struct taskstats *ptgidstats) +static inline void taskstats_exit_free(struct taskstats *ptidstats) {} static inline void taskstats_exit_send(struct task_struct *tsk, - struct taskstats *tidstats, - struct taskstats *tgidstats) + struct taskstats *tidstats, + int group_dead) +{} +static inline void taskstats_tgid_init(struct signal_struct *sig) +{} +static inline void taskstats_tgid_alloc(struct signal_struct *sig) +{} +static inline void taskstats_tgid_free(struct signal_struct *sig) {} static inline void taskstats_init_early(void) {} diff --git a/kernel/exit.c b/kernel/exit.c index 9852ed8c2988..67c1e9a4f812 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -845,7 +845,7 @@ static void exit_notify(struct task_struct *tsk) fastcall NORET_TYPE void do_exit(long code) { struct task_struct *tsk = current; - struct taskstats *tidstats, *tgidstats; + struct taskstats *tidstats; int group_dead; profile_task_exit(tsk); @@ -884,7 +884,7 @@ fastcall NORET_TYPE void do_exit(long code) current->comm, current->pid, preempt_count()); - taskstats_exit_alloc(&tidstats, &tgidstats); + taskstats_exit_alloc(&tidstats); acct_update_integrals(tsk); if (tsk->mm) { @@ -905,8 +905,8 @@ fastcall NORET_TYPE void do_exit(long code) #endif if (unlikely(tsk->audit_context)) audit_free(tsk); - taskstats_exit_send(tsk, tidstats, tgidstats); - taskstats_exit_free(tidstats, tgidstats); + taskstats_exit_send(tsk, tidstats, group_dead); + taskstats_exit_free(tidstats); delayacct_tsk_exit(tsk); exit_mm(tsk); diff --git a/kernel/fork.c b/kernel/fork.c index 451cfd35bf22..1b0f7b1e0881 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -819,6 +820,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts if (clone_flags & CLONE_THREAD) { atomic_inc(¤t->signal->count); atomic_inc(¤t->signal->live); + taskstats_tgid_alloc(current->signal); return 0; } sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); @@ -863,6 +865,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts INIT_LIST_HEAD(&sig->cpu_timers[0]); INIT_LIST_HEAD(&sig->cpu_timers[1]); INIT_LIST_HEAD(&sig->cpu_timers[2]); + taskstats_tgid_init(sig); task_lock(current->group_leader); memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); @@ -884,6 +887,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts void __cleanup_signal(struct signal_struct *sig) { exit_thread_group_keys(sig); + taskstats_tgid_free(sig); kmem_cache_free(signal_cachep, sig); } diff --git a/kernel/taskstats.c b/kernel/taskstats.c index ea9506de3b85..4a0a5022b299 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -132,46 +132,79 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk, static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk, struct taskstats *stats) { - int rc; struct task_struct *tsk, *first; + unsigned long flags; + /* + * Add additional stats from live tasks except zombie thread group + * leaders who are already counted with the dead tasks + */ first = tgidtsk; - read_lock(&tasklist_lock); if (!first) { + read_lock(&tasklist_lock); first = find_task_by_pid(tgid); if (!first) { read_unlock(&tasklist_lock); return -ESRCH; } - } + get_task_struct(first); + read_unlock(&tasklist_lock); + } else + get_task_struct(first); + + /* Start with stats from dead tasks */ + spin_lock_irqsave(&first->signal->stats_lock, flags); + if (first->signal->stats) + memcpy(stats, first->signal->stats, sizeof(*stats)); + spin_unlock_irqrestore(&first->signal->stats_lock, flags); + tsk = first; + read_lock(&tasklist_lock); do { + if (tsk->exit_state == EXIT_ZOMBIE && thread_group_leader(tsk)) + continue; /* - * Each accounting subsystem adds calls its functions to + * Accounting subsystem can call its functions here to * fill in relevant parts of struct taskstsats as follows * - * rc = per-task-foo(stats, tsk); - * if (rc) - * break; + * per-task-foo(stats, tsk); */ - - rc = delayacct_add_tsk(stats, tsk); - if (rc) - break; + delayacct_add_tsk(stats, tsk); } while_each_thread(first, tsk); read_unlock(&tasklist_lock); stats->version = TASKSTATS_VERSION; - /* - * Accounting subsytems can also add calls here if they don't - * wish to aggregate statistics for per-tgid stats + * Accounting subsytems can also add calls here to modify + * fields of taskstats. */ - return rc; + return 0; +} + + +static void fill_tgid_exit(struct task_struct *tsk) +{ + unsigned long flags; + + spin_lock_irqsave(&tsk->signal->stats_lock, flags); + if (!tsk->signal->stats) + goto ret; + + /* + * Each accounting subsystem calls its functions here to + * accumalate its per-task stats for tsk, into the per-tgid structure + * + * per-task-foo(tsk->signal->stats, tsk); + */ + delayacct_add_tsk(tsk->signal->stats, tsk); +ret: + spin_unlock_irqrestore(&tsk->signal->stats_lock, flags); + return; } + static int taskstats_send_stats(struct sk_buff *skb, struct genl_info *info) { int rc = 0; @@ -230,7 +263,7 @@ err: /* Send pid data out on exit */ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, - struct taskstats *tgidstats) + int group_dead) { int rc; struct sk_buff *rep_skb; @@ -238,13 +271,16 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, size_t size; int is_thread_group; struct nlattr *na; + unsigned long flags; if (!family_registered || !tidstats) return; - is_thread_group = !thread_group_empty(tsk); - rc = 0; + spin_lock_irqsave(&tsk->signal->stats_lock, flags); + is_thread_group = tsk->signal->stats ? 1 : 0; + spin_unlock_irqrestore(&tsk->signal->stats_lock, flags); + rc = 0; /* * Size includes space for nested attributes */ @@ -268,30 +304,28 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, *tidstats); nla_nest_end(rep_skb, na); - if (!is_thread_group || !tgidstats) { - send_reply(rep_skb, 0, TASKSTATS_MSG_MULTICAST); - goto ret; - } + if (!is_thread_group) + goto send; - rc = fill_tgid(tsk->pid, tsk, tgidstats); /* - * If fill_tgid() failed then one probable reason could be that the - * thread group leader has exited. fill_tgid() will fail, send out - * the pid statistics collected earlier. + * tsk has/had a thread group so fill the tsk->signal->stats structure + * Doesn't matter if tsk is the leader or the last group member leaving */ - if (rc < 0) { - send_reply(rep_skb, 0, TASKSTATS_MSG_MULTICAST); - goto ret; - } + + fill_tgid_exit(tsk); + if (!group_dead) + goto send; na = nla_nest_start(rep_skb, TASKSTATS_TYPE_AGGR_TGID); NLA_PUT_U32(rep_skb, TASKSTATS_TYPE_TGID, (u32)tsk->tgid); + /* No locking needed for tsk->signal->stats since group is dead */ NLA_PUT_TYPE(rep_skb, struct taskstats, TASKSTATS_TYPE_STATS, - *tgidstats); + *tsk->signal->stats); nla_nest_end(rep_skb, na); +send: send_reply(rep_skb, 0, TASKSTATS_MSG_MULTICAST); - goto ret; + return; nla_put_failure: genlmsg_cancel(rep_skb, reply); -- cgit v1.2.3