taskstats: set version field for tgid exit
PATCH 1/1 taskstats: set version field for tgid exit
Currently, an aggregated taskstats struct for task group exit does not have its version field set. This patch fixes it.
Signed-off-by Xidorn Quan <[email protected]>
---
Users of taskstats may expect that version of the struct is always set up properly, so that they can check whether it's supported.
--- kernel/taskstats.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/taskstats.c +6 -3
@@ -258,18 +258,21 @@ static int fill_stats_for_tgid(pid_t tgid, struct taskstats *stats)static void fill_tgid_exit (struct task_struct *tsk) {unsigned long flags; +struct taskstats *stats;spin_lock_irqsave (&tsk->sighand->siglock, flags); -if (!tsk->signal->stats) + stats = tsk->signal->stats; +if (!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); +* per-task-foo(stats, tsk); */ -delayacct_add_tsk (tsk->signal->stats, tsk); +delayacct_add_tsk (stats, tsk); + stats->version =TASKSTATS_VERSION ; ret:spin_unlock_irqrestore (&tsk->sighand->siglock, flags);return ;
Signature · 1 line
2.25.1