[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210317083141.GB3881262@gmail.com>
Date: Wed, 17 Mar 2021 09:31:41 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Josh Don <joshdon@...gle.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
Iurii Zaikin <yzaikin@...gle.com>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
David Rientjes <rientjes@...gle.com>,
Oleg Rombakh <olegrom@...gle.com>, Paul Turner <pjt@...gle.com>
Subject: Re: [PATCH] sched: Warn on long periods of pending need_resched
* Josh Don <joshdon@...gle.com> wrote:
> +static inline u64 resched_latency_check(struct rq *rq)
> +{
> + int latency_warn_ms = READ_ONCE(sysctl_resched_latency_warn_ms);
> + bool warn_only_once = (latency_warn_ms == RESCHED_DEFAULT_WARN_LATENCY_MS);
> + u64 need_resched_latency, now = rq_clock(rq);
> + static bool warned_once;
> +
> + if (warn_only_once && warned_once)
> + return 0;
> +
> + if (!need_resched() || latency_warn_ms < 2)
> + return 0;
> +
> + /* Disable this warning for the first few mins after boot */
> + if (now < RESCHED_BOOT_QUIET_SEC * NSEC_PER_SEC)
> + return 0;
> +
> + if (!rq->last_seen_need_resched_ns) {
> + rq->last_seen_need_resched_ns = now;
> + rq->ticks_without_resched = 0;
> + return 0;
> + }
> +
> + rq->ticks_without_resched++;
So AFAICS this will only really do something useful on full-nohz
kernels with sufficiently long scheduler ticks, right?
On other kernels the scheduler tick interrupt, when it returns to
user-space, will trigger a reschedule if it sees a need_resched.
Thanks,
Ingo
Powered by blists - more mailing lists