Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 022b6fdc authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

timer: don't wakeup idle CPUs unnecessarily



Kick the target CPU to re-evaluate the timer wheel only if the
timer being enqueued expires before the programmed next tick
event.

Change-Id: Id467ad069db59885b680f6a8e9f65f1a172af541
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent e4b8535d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -408,6 +408,8 @@ __internal_add_timer(struct tvec_base *base, struct timer_list *timer)

static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
{
	int leftmost = 0;

	(void)catchup_timer_jiffies(base);
	__internal_add_timer(base, timer);
	/*
@@ -415,8 +417,10 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
	 */
	if (!tbase_get_deferrable(timer->base)) {
		if (!base->active_timers++ ||
		    time_before(timer->expires, base->next_timer))
		    time_before(timer->expires, base->next_timer)) {
			base->next_timer = timer->expires;
			leftmost = 1;
		}
	}
	base->all_timers++;

@@ -433,7 +437,7 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
	 * require special care against races with idle_cpu(), lets deal
	 * with that later.
	 */
	if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(base->cpu))
	if (leftmost || tick_nohz_full_cpu(base->cpu))
		wake_up_nohz_cpu(base->cpu);
}