aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/posix-timers.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-26 20:22:24 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-08-28 11:50:39 +0200
commit87dc64480fb19a6a0fedbdff1e2557be50673287 (patch)
treea3e0e5cc5769ecc2683bee0e8485a48436206a9e /include/linux/posix-timers.h
parentposix-cpu-timers: Remove cputime_expires (diff)
downloadlinux-dev-87dc64480fb19a6a0fedbdff1e2557be50673287.tar.xz
linux-dev-87dc64480fb19a6a0fedbdff1e2557be50673287.zip
posix-cpu-timers: Restructure expiry array
Now that the abused struct task_cputime is gone, it's more natural to bundle the expiry cache and the list head of each clock into a struct and have an array of those structs. Follow the hrtimer naming convention of 'bases' and rename the expiry cache to 'nextevt' and adapt all usage sites. Generates also better code .text size shrinks by 80 bytes. Suggested-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1908262021140.1939@nanos.tec.linutronix.de
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r--include/linux/posix-timers.h41
1 files changed, 27 insertions, 14 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index fd9098467d6d..64bd10d251fe 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -63,24 +63,33 @@ static inline int clockid_to_fd(const clockid_t clk)
}
#ifdef CONFIG_POSIX_TIMERS
+
/**
- * posix_cputimers - Container for posix CPU timer related data
- * @expiries: Earliest-expiration cache array based
+ * posix_cputimer_base - Container per posix CPU clock
+ * @nextevt: Earliest-expiration cache
* @cpu_timers: List heads to queue posix CPU timers
+ */
+struct posix_cputimer_base {
+ u64 nextevt;
+ struct list_head cpu_timers;
+};
+
+/**
+ * posix_cputimers - Container for posix CPU timer related data
+ * @bases: Base container for posix CPU clocks
*
* Used in task_struct and signal_struct
*/
struct posix_cputimers {
- u64 expiries[CPUCLOCK_MAX];
- struct list_head cpu_timers[CPUCLOCK_MAX];
+ struct posix_cputimer_base bases[CPUCLOCK_MAX];
};
static inline void posix_cputimers_init(struct posix_cputimers *pct)
{
- memset(&pct->expiries, 0, sizeof(pct->expiries));
- INIT_LIST_HEAD(&pct->cpu_timers[0]);
- INIT_LIST_HEAD(&pct->cpu_timers[1]);
- INIT_LIST_HEAD(&pct->cpu_timers[2]);
+ memset(pct->bases, 0, sizeof(pct->bases));
+ INIT_LIST_HEAD(&pct->bases[0].cpu_timers);
+ INIT_LIST_HEAD(&pct->bases[1].cpu_timers);
+ INIT_LIST_HEAD(&pct->bases[2].cpu_timers);
}
void posix_cputimers_group_init(struct posix_cputimers *pct, u64 cpu_limit);
@@ -88,19 +97,23 @@ void posix_cputimers_group_init(struct posix_cputimers *pct, u64 cpu_limit);
static inline void posix_cputimers_rt_watchdog(struct posix_cputimers *pct,
u64 runtime)
{
- pct->expiries[CPUCLOCK_SCHED] = runtime;
+ pct->bases[CPUCLOCK_SCHED].nextevt = runtime;
}
/* Init task static initializer */
-#define INIT_CPU_TIMERLISTS(c) { \
- LIST_HEAD_INIT(c.cpu_timers[0]), \
- LIST_HEAD_INIT(c.cpu_timers[1]), \
- LIST_HEAD_INIT(c.cpu_timers[2]), \
+#define INIT_CPU_TIMERBASE(b) { \
+ .cpu_timers = LIST_HEAD_INIT(b.cpu_timers), \
+}
+
+#define INIT_CPU_TIMERBASES(b) { \
+ INIT_CPU_TIMERBASE(b[0]), \
+ INIT_CPU_TIMERBASE(b[1]), \
+ INIT_CPU_TIMERBASE(b[2]), \
}
#define INIT_CPU_TIMERS(s) \
.posix_cputimers = { \
- .cpu_timers = INIT_CPU_TIMERLISTS(s.posix_cputimers), \
+ .bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \
},
#else
struct posix_cputimers { };