summaryrefslogtreecommitdiff
path: root/kernel/time/posix-cpu-timers.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-21 21:09:04 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-08-28 11:50:33 +0200
commit2b69942f9021bf75bd1b001f53bd2578361fadf3 (patch)
tree1d51a30bd34edc3c0a723a306199b1018e404db3 /kernel/time/posix-cpu-timers.c
parentab693c5a5e3107f035d5162e6ada9aaf7dd76a1d (diff)
posix-cpu-timers: Create a container struct
Per task/process data of posix CPU timers is all over the place which makes the code hard to follow and requires ifdeffery. Create a container to hold all this information in one place, so data is consolidated and the ifdeffery can be confined to the posix timer header file and removed from places like fork. As a first step, move the cpu_timers list head array into the new struct and clean up the initializers and simplify fork. The remaining #ifdef in fork will be removed later. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20190821192920.819418976@linutronix.de
Diffstat (limited to 'kernel/time/posix-cpu-timers.c')
-rw-r--r--kernel/time/posix-cpu-timers.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index b1c97664a730..849e2045fb6e 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -407,11 +407,11 @@ static void cleanup_timers_list(struct list_head *head)
*
* This must be called with the siglock held.
*/
-static void cleanup_timers(struct list_head *head)
+static void cleanup_timers(struct posix_cputimers *pct)
{
- cleanup_timers_list(head);
- cleanup_timers_list(++head);
- cleanup_timers_list(++head);
+ cleanup_timers_list(&pct->cpu_timers[CPUCLOCK_PROF]);
+ cleanup_timers_list(&pct->cpu_timers[CPUCLOCK_VIRT]);
+ cleanup_timers_list(&pct->cpu_timers[CPUCLOCK_SCHED]);
}
/*
@@ -421,11 +421,11 @@ static void cleanup_timers(struct list_head *head)
*/
void posix_cpu_timers_exit(struct task_struct *tsk)
{
- cleanup_timers(tsk->cpu_timers);
+ cleanup_timers(&tsk->posix_cputimers);
}
void posix_cpu_timers_exit_group(struct task_struct *tsk)
{
- cleanup_timers(tsk->signal->cpu_timers);
+ cleanup_timers(&tsk->signal->posix_cputimers);
}
static inline int expires_gt(u64 expires, u64 new_exp)
@@ -446,10 +446,10 @@ static void arm_timer(struct k_itimer *timer)
struct cpu_timer_list *next;
if (CPUCLOCK_PERTHREAD(timer->it_clock)) {
- head = p->cpu_timers;
+ head = p->posix_cputimers.cpu_timers;
cputime_expires = &p->cputime_expires;
} else {
- head = p->signal->cpu_timers;
+ head = p->signal->posix_cputimers.cpu_timers;
cputime_expires = &p->signal->cputime_expires;
}
head += CPUCLOCK_WHICH(timer->it_clock);
@@ -773,8 +773,8 @@ static inline void check_dl_overrun(struct task_struct *tsk)
static void check_thread_timers(struct task_struct *tsk,
struct list_head *firing)
{
+ struct list_head *timers = tsk->posix_cputimers.cpu_timers;
struct task_cputime *tsk_expires = &tsk->cputime_expires;
- struct list_head *timers = tsk->cpu_timers;
u64 expires, stime, utime;
unsigned long soft;
@@ -879,9 +879,9 @@ static void check_process_timers(struct task_struct *tsk,
struct list_head *firing)
{
struct signal_struct *const sig = tsk->signal;
+ struct list_head *timers = sig->posix_cputimers.cpu_timers;
u64 utime, ptime, virt_expires, prof_expires;
u64 sum_sched_runtime, sched_expires;
- struct list_head *timers = sig->cpu_timers;
struct task_cputime cputime;
unsigned long soft;