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);
 
 /* 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) {                                       \
 
        }
 }
 
-static inline bool expiry_cache_is_zero(const struct posix_cputimers *pct)
+/* Check whether all cache entries contain U64_MAX, i.e. eternal expiry time */
+static inline bool expiry_cache_is_inactive(const struct posix_cputimers *pct)
 {
-       return !(pct->bases[CPUCLOCK_PROF].nextevt |
-                pct->bases[CPUCLOCK_VIRT].nextevt |
-                pct->bases[CPUCLOCK_SCHED].nextevt);
+       return !(~pct->bases[CPUCLOCK_PROF].nextevt |
+                ~pct->bases[CPUCLOCK_VIRT].nextevt |
+                ~pct->bases[CPUCLOCK_SCHED].nextevt);
 }
 
 static int
        cleanup_timers(&tsk->signal->posix_cputimers);
 }
 
-static inline int expires_gt(u64 expires, u64 new_exp)
-{
-       return expires == 0 || expires > new_exp;
-}
-
 /*
  * Insert the timer on the appropriate list before any timers that
  * expire later.  This must be called with the sighand lock held.
         * for process timers we share expiration cache with itimers
         * and RLIMIT_CPU and for thread timers with RLIMIT_RTTIME.
         */
-       if (expires_gt(base->nextevt, newexp))
+       if (newexp < base->nextevt)
                base->nextevt = newexp;
 
        if (CPUCLOCK_PERTHREAD(timer->it_clock))
                list_move_tail(&t->entry, firing);
        }
 
-       return 0;
+       return U64_MAX;
 }
 
 static inline void check_dl_overrun(struct task_struct *tsk)
        if (dl_task(tsk))
                check_dl_overrun(tsk);
 
-       /*
-        * If the expiry cache is zero, then there are no active per thread
-        * CPU timers.
-        */
-       if (expiry_cache_is_zero(&tsk->posix_cputimers))
+       if (expiry_cache_is_inactive(&tsk->posix_cputimers))
                return;
 
        task_cputime(tsk, &utime, &stime);
                }
        }
 
-       if (expiry_cache_is_zero(&tsk->posix_cputimers))
+       if (expiry_cache_is_inactive(&tsk->posix_cputimers))
                tick_dep_clear_task(tsk, TICK_DEP_BIT_POSIX_TIMER);
 }
 
                __group_send_sig_info(signo, SEND_SIG_PRIV, tsk);
        }
 
-       if (it->expires && (!*expires || it->expires < *expires))
+       if (it->expires && it->expires < *expires)
                *expires = it->expires;
 }
 
                        }
                }
                softns = soft * NSEC_PER_SEC;
-               if (!prof_exp || softns < prof_exp)
+               if (softns < prof_exp)
                        prof_exp = softns;
        }
 
        base[CPUCLOCK_VIRT].nextevt = virt_exp;
        base[CPUCLOCK_SCHED].nextevt = sched_exp;
 
-       if (expiry_cache_is_zero(&sig->posix_cputimers))
+       if (expiry_cache_is_inactive(&sig->posix_cputimers))
                stop_process_timers(sig);
 
        sig->cputimer.checking_timer = false;
        int i;
 
        for (i = 0; i < CPUCLOCK_MAX; i++) {
-               if (pct->bases[i].nextevt && sample[i] >= pct->bases[i].nextevt)
+               if (sample[i] >= pct->bases[i].nextevt)
                        return true;
        }
        return false;
 {
        struct signal_struct *sig;
 
-       if (!expiry_cache_is_zero(&tsk->posix_cputimers)) {
+       if (!expiry_cache_is_inactive(&tsk->posix_cputimers)) {
                u64 samples[CPUCLOCK_MAX];
 
                task_sample_cputime(tsk, samples);
         * Update expiration cache if this is the earliest timer. CPUCLOCK_PROF
         * expiry cache is also used by RLIMIT_CPU!.
         */
-       if (expires_gt(*nextevt, *newval))
+       if (*newval < *nextevt)
                *nextevt = *newval;
 
        tick_dep_set_signal(tsk->signal, TICK_DEP_BIT_POSIX_TIMER);