mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-01 03:11:59 +00:00
posix-cpu-timers: Get rid of zero checks
Deactivation of the expiry cache is done by setting all clock caches to 0. That requires to have a check for zero in all places which update the expiry cache: if (cache == 0 || new < cache) cache = new; Use U64_MAX as the deactivated value, which allows to remove the zero checks when updating the cache and reduces it to the obvious check: if (new < cache) cache = new; This also removes the weird workaround in do_prlimit() which was required to convert a RLIMIT_CPU value of 0 (immediate expiry) to 1 because handing in 0 to the posix CPU timer code would have effectively disarmed it. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20190821192922.275086128@linutronix.de
This commit is contained in:
parent
24db4dd90d
commit
2bbdbdae05
3 changed files with 20 additions and 34 deletions
|
@ -86,7 +86,9 @@ struct posix_cputimers {
|
|||
|
||||
static inline void posix_cputimers_init(struct posix_cputimers *pct)
|
||||
{
|
||||
memset(pct->bases, 0, sizeof(pct->bases));
|
||||
pct->bases[0].nextevt = U64_MAX;
|
||||
pct->bases[1].nextevt = U64_MAX;
|
||||
pct->bases[2].nextevt = U64_MAX;
|
||||
INIT_LIST_HEAD(&pct->bases[0].cpu_timers);
|
||||
INIT_LIST_HEAD(&pct->bases[1].cpu_timers);
|
||||
INIT_LIST_HEAD(&pct->bases[2].cpu_timers);
|
||||
|
@ -102,7 +104,8 @@ static inline void posix_cputimers_rt_watchdog(struct posix_cputimers *pct,
|
|||
|
||||
/* Init task static initializer */
|
||||
#define INIT_CPU_TIMERBASE(b) { \
|
||||
.cpu_timers = LIST_HEAD_INIT(b.cpu_timers), \
|
||||
.nextevt = U64_MAX, \
|
||||
.cpu_timers = LIST_HEAD_INIT(b.cpu_timers), \
|
||||
}
|
||||
|
||||
#define INIT_CPU_TIMERBASES(b) { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue