mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] taskstats: fix sub-threads accounting
If there are no listeners, taskstats_exit_send() just returns because taskstats_exit_alloc() didn't allocate *tidstats. This is wrong, each sub-thread should do fill_tgid_exit() on exit, otherwise its ->delays is not recorded in ->signal->stats and lost. Q: We don't send TASKSTATS_TYPE_AGGR_TGID when single-threaded process exits. Is it good? How can the listener figure out that it was actually a process exit, not sub-thread? Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Balbir Singh <balbir@in.ibm.com> Acked-by: Shailabh Nagar <nagar@watson.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
525fdb6cc9
commit
4a279ff1ea
1 changed files with 10 additions and 7 deletions
|
@ -455,10 +455,9 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
|
||||||
int is_thread_group;
|
int is_thread_group;
|
||||||
struct nlattr *na;
|
struct nlattr *na;
|
||||||
|
|
||||||
if (!family_registered || !tidstats)
|
if (!family_registered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
/*
|
/*
|
||||||
* Size includes space for nested attributes
|
* Size includes space for nested attributes
|
||||||
*/
|
*/
|
||||||
|
@ -466,8 +465,15 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
|
||||||
nla_total_size(sizeof(struct taskstats)) + nla_total_size(0);
|
nla_total_size(sizeof(struct taskstats)) + nla_total_size(0);
|
||||||
|
|
||||||
is_thread_group = (tsk->signal->stats != NULL);
|
is_thread_group = (tsk->signal->stats != NULL);
|
||||||
if (is_thread_group)
|
if (is_thread_group) {
|
||||||
size = 2 * size; /* PID + STATS + TGID + STATS */
|
/* PID + STATS + TGID + STATS */
|
||||||
|
size = 2 * size;
|
||||||
|
/* fill the tsk->signal->stats structure */
|
||||||
|
fill_tgid_exit(tsk);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tidstats)
|
||||||
|
return;
|
||||||
|
|
||||||
rc = prepare_reply(NULL, TASKSTATS_CMD_NEW, &rep_skb, &reply, size);
|
rc = prepare_reply(NULL, TASKSTATS_CMD_NEW, &rep_skb, &reply, size);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
@ -487,11 +493,8 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats,
|
||||||
goto send;
|
goto send;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
* Doesn't matter if tsk is the leader or the last group member leaving
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fill_tgid_exit(tsk);
|
|
||||||
if (!group_dead)
|
if (!group_dead)
|
||||||
goto send;
|
goto send;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue