From: Ankur Arora <ankur.a.arora@oracle.com>
To: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Ankur Arora <ankur.a.arora@oracle.com>,
linux-kernel@vger.kernel.org, peterz@infradead.org,
tglx@linutronix.de, paulmck@kernel.org, mingo@kernel.org,
bigeasy@linutronix.de, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, frederic@kernel.org, efault@gmx.de
Subject: Re: [PATCH 1/7] sched: warn for high latency with TIF_NEED_RESCHED_LAZY
Date: Mon, 21 Oct 2024 12:21:13 -0700 [thread overview]
Message-ID: <87iktli7o6.fsf@oracle.com> (raw)
In-Reply-To: <c8dd612a-1851-471f-b5c5-f4201593e7b0@linux.ibm.com>
Shrikanth Hegde <sshegde@linux.ibm.com> writes:
> On 10/9/24 22:24, Ankur Arora wrote:
>> resched_latency_warn() now also warns if TIF_NEED_RESCHED_LAZY is set
>> without rescheduling for more than the latency_warn_ms period.
>>
>
> I am bit confused here. Why do we need to warn if LAZY is set for a long time?
>
> If lazy set, the subsequent tick, it would be set to upgraded to NEED_RESCHED.
>
> Since the value of latency_warn_ms=100ms, that means even on system with HZ=100,
> that means 10 ticks before that warning would be printed no?
That's a fair point. However, the assumption there is that there are no
bugs in upgrade on tick or that there's no situation in which the tick
is off for a prolonged period.
Ankur
> IIUC, the changelog c006fac556e40 ("sched: Warn on long periods of pending
> need_resched") has the concern of need_resched set but if it is non-preemptible
> kernel it would spend a lot of time in kernel mode. In that case print a
> warning.
>
> If someone enables Lazy, that means it is preemptible and probably this whole
> notion of resched_latency_warn doesn't apply to lazy. Please correct me if i am
> not understanding this correctly.
>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Peter Ziljstra <peterz@infradead.org>
>> Cc: Juri Lelli <juri.lelli@redhat.com>
>> Cc: Vincent Guittot <vincent.guittot@linaro.org>
>> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
>> ---
>> kernel/sched/core.c | 2 +-
>> kernel/sched/debug.c | 7 +++++--
>> 2 files changed, 6 insertions(+), 3 deletions(-)
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 694bfcf153cb..1229766b704e 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -5571,7 +5571,7 @@ static u64 cpu_resched_latency(struct rq *rq)
>> if (sysctl_resched_latency_warn_once && warned_once)
>> return 0;
>> - if (!need_resched() || !latency_warn_ms)
>> + if ((!need_resched() && !tif_need_resched_lazy()) || !latency_warn_ms)
>> return 0;
>> if (system_state == SYSTEM_BOOTING)
>> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
>> index 9abcc6ead11b..f0d551ba64bb 100644
>> --- a/kernel/sched/debug.c
>> +++ b/kernel/sched/debug.c
>> @@ -1293,9 +1293,12 @@ void proc_sched_set_task(struct task_struct *p)
>> void resched_latency_warn(int cpu, u64 latency)
>> {
>> static DEFINE_RATELIMIT_STATE(latency_check_ratelimit, 60 * 60 * HZ, 1);
>> + char *nr;
>> +
>> + nr = tif_need_resched() ? "need_resched" : "need_resched_lazy";
>> WARN(__ratelimit(&latency_check_ratelimit),
>> - "sched: CPU %d need_resched set for > %llu ns (%d ticks) "
>> + "sched: CPU %d %s set for > %llu ns (%d ticks) "
>> "without schedule\n",
>> - cpu, latency, cpu_rq(cpu)->ticks_without_resched);
>> + cpu, nr, latency, cpu_rq(cpu)->ticks_without_resched);
>> }
--
ankur
next prev parent reply other threads:[~2024-10-21 19:21 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 16:54 [PATCH 0/7] Lazy preemption bits Ankur Arora
2024-10-09 16:54 ` [PATCH 1/7] sched: warn for high latency with TIF_NEED_RESCHED_LAZY Ankur Arora
2024-10-10 6:37 ` Sebastian Andrzej Siewior
2024-10-10 18:19 ` Ankur Arora
2024-10-13 9:44 ` kernel test robot
2024-10-13 9:54 ` kernel test robot
2024-10-16 9:36 ` Shrikanth Hegde
2024-10-21 19:21 ` Ankur Arora [this message]
2024-10-22 5:41 ` Shrikanth Hegde
2024-10-09 16:54 ` [PATCH 2/7] rcu: limit PREEMPT_RCU configurations Ankur Arora
2024-10-09 18:01 ` Peter Zijlstra
2024-10-09 18:24 ` Paul E. McKenney
2024-10-09 20:52 ` Peter Zijlstra
2024-10-09 21:16 ` Paul E. McKenney
2024-10-10 7:58 ` Peter Zijlstra
2024-10-10 14:19 ` Paul E. McKenney
2024-10-10 6:32 ` Sebastian Andrzej Siewior
2024-10-10 8:10 ` Peter Zijlstra
2024-10-10 9:13 ` Sebastian Andrzej Siewior
2024-10-10 10:03 ` Peter Zijlstra
2024-10-10 10:26 ` Sebastian Andrzej Siewior
2024-10-10 10:44 ` Peter Zijlstra
2024-10-10 14:29 ` Paul E. McKenney
2024-10-11 8:18 ` Sebastian Andrzej Siewior
2024-10-11 13:59 ` Paul E. McKenney
2024-10-11 14:43 ` Sebastian Andrzej Siewior
2024-10-11 15:59 ` Paul E. McKenney
2024-10-15 11:22 ` Sebastian Andrzej Siewior
2024-10-15 22:13 ` Ankur Arora
2024-10-17 8:04 ` Sebastian Andrzej Siewior
2024-10-17 22:50 ` Ankur Arora
2024-10-18 17:43 ` Paul E. McKenney
2024-10-18 19:18 ` Ankur Arora
2024-10-18 23:24 ` Paul E. McKenney
2024-10-19 1:07 ` Ankur Arora
2024-10-19 4:30 ` Paul E. McKenney
2024-10-15 23:11 ` Paul E. McKenney
2024-10-17 7:07 ` Sebastian Andrzej Siewior
2024-10-18 17:38 ` Paul E. McKenney
2024-10-21 11:27 ` Sebastian Andrzej Siewior
2024-10-21 16:48 ` Paul E. McKenney
2024-10-21 19:20 ` Ankur Arora
2024-10-22 23:49 ` Paul E. McKenney
2024-10-22 14:09 ` Sebastian Andrzej Siewior
2024-10-22 23:54 ` Paul E. McKenney
2024-10-23 6:58 ` Sebastian Andrzej Siewior
2024-10-10 17:35 ` Ankur Arora
2024-10-11 7:58 ` Sebastian Andrzej Siewior
2024-10-15 23:01 ` Ankur Arora
2024-10-10 17:42 ` Ankur Arora
2024-10-09 16:54 ` [PATCH 3/7] rcu: fix header guard for rcu_all_qs() Ankur Arora
2024-10-10 6:41 ` Sebastian Andrzej Siewior
2024-10-10 8:11 ` Peter Zijlstra
2024-10-10 14:29 ` Paul E. McKenney
2024-10-09 16:54 ` [PATCH 4/7] rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y Ankur Arora
2024-10-09 19:05 ` Ankur Arora
2024-10-10 14:37 ` Paul E. McKenney
2024-10-10 17:59 ` Ankur Arora
2024-10-10 6:50 ` Sebastian Andrzej Siewior
2024-10-10 17:56 ` Ankur Arora
2024-10-11 7:52 ` Sebastian Andrzej Siewior
2024-10-09 16:54 ` [PATCH 5/7] rcu: rename PREEMPT_AUTO to PREEMPT_LAZY Ankur Arora
2024-10-09 18:02 ` Peter Zijlstra
2024-10-09 18:52 ` Ankur Arora
2024-10-09 16:54 ` [PATCH 6/7] osnoise: handle quiescent states for PREEMPT_RCU=n, PREEMPTION=y Ankur Arora
2024-10-10 6:53 ` Sebastian Andrzej Siewior
2024-10-10 14:39 ` Paul E. McKenney
2024-10-10 17:50 ` Ankur Arora
2024-10-11 7:36 ` Sebastian Andrzej Siewior
2024-10-14 20:14 ` Ankur Arora
2024-10-09 16:54 ` [PATCH 7/7] powerpc: add support for PREEMPT_LAZY Ankur Arora
2024-10-10 7:22 ` Sebastian Andrzej Siewior
2024-10-10 18:10 ` Ankur Arora
2024-10-11 18:35 ` Shrikanth Hegde
2024-10-12 22:42 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iktli7o6.fsf@oracle.com \
--to=ankur.a.arora@oracle.com \
--cc=bigeasy@linutronix.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=efault@gmx.de \
--cc=frederic@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sshegde@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox