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

Commit cdc0613d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "timers: Clear timer_base::must_forward_clk with timer_base::lock held"

parents 07bdd12f cd3ede47
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -1657,6 +1657,22 @@ static inline void __run_timers(struct timer_base *base)

	spin_lock_irq(&base->lock);

	/*
	 * timer_base::must_forward_clk must be cleared before running
	 * timers so that any timer functions that call mod_timer() will
	 * not try to forward the base. Idle tracking / clock forwarding
	 * logic is only used with BASE_STD timers.
	 *
	 * The must_forward_clk flag is cleared unconditionally also for
	 * the deferrable base. The deferrable base is not affected by idle
	 * tracking and never forwarded, so clearing the flag is a NOOP.
	 *
	 * The fact that the deferrable base is never forwarded can cause
	 * large variations in granularity for deferrable timers, but they
	 * can be deferred for long periods due to idle anyway.
	 */
	base->must_forward_clk = false;

	while (time_after_eq(jiffies, base->clk)) {

		levels = collect_expired_timers(base, heads);
@@ -1676,19 +1692,6 @@ static __latent_entropy void run_timer_softirq(struct softirq_action *h)
{
	struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);

	/*
	 * must_forward_clk must be cleared before running timers so that any
	 * timer functions that call mod_timer will not try to forward the
	 * base. idle trcking / clock forwarding logic is only used with
	 * BASE_STD timers.
	 *
	 * The deferrable base does not do idle tracking at all, so we do
	 * not forward it. This can result in very large variations in
	 * granularity for deferrable timers, but they can be deferred for
	 * long periods due to idle.
	 */
	base->must_forward_clk = false;

	__run_timers(base);
	if (IS_ENABLED(CONFIG_NO_HZ_COMMON))
		__run_timers(this_cpu_ptr(&timer_bases[BASE_DEF]));