diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-08-21 21:09:24 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-08-28 11:50:42 +0200 |
commit | 244d49e30653658d4e7e9b2b8427777cbbc5affe (patch) | |
tree | 97754f775acd11c4bc98b43f69234dfb525cb175 /include/linux/sched/cputime.h | |
parent | posix-cpu-timers: Deduplicate rlimit handling (diff) | |
download | linux-dev-244d49e30653658d4e7e9b2b8427777cbbc5affe.tar.xz linux-dev-244d49e30653658d4e7e9b2b8427777cbbc5affe.zip |
posix-cpu-timers: Move state tracking to struct posix_cputimers
Put it where it belongs and clean up the ifdeffery in fork completely.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190821192922.743229404@linutronix.de
Diffstat (limited to 'include/linux/sched/cputime.h')
-rw-r--r-- | include/linux/sched/cputime.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/sched/cputime.h b/include/linux/sched/cputime.h index eefa5dff16b4..6c9f19a33865 100644 --- a/include/linux/sched/cputime.h +++ b/include/linux/sched/cputime.h @@ -70,7 +70,7 @@ void thread_group_sample_cputime(struct task_struct *tsk, u64 *samples); */ /** - * get_running_cputimer - return &tsk->signal->cputimer if cputimer is running + * get_running_cputimer - return &tsk->signal->cputimer if cputimers are active * * @tsk: Pointer to target task. */ @@ -80,8 +80,11 @@ struct thread_group_cputimer *get_running_cputimer(struct task_struct *tsk) { struct thread_group_cputimer *cputimer = &tsk->signal->cputimer; - /* Check if cputimer isn't running. This is accessed without locking. */ - if (!READ_ONCE(cputimer->running)) + /* + * Check whether posix CPU timers are active. If not the thread + * group accounting is not active either. Lockless check. + */ + if (!READ_ONCE(tsk->signal->posix_cputimers.timers_active)) return NULL; /* |