mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Sechang Lim <rhkrqnwk98@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Gabriele Monaco <gmonaco@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] sched: set TIF_NEED_RESCHED before calling __trace_set_need_resched()
Date: Mon, 29 Jun 2026 09:41:15 +0530	[thread overview]
Message-ID: <b8aca553-ee93-4b91-a428-f50d62da9ead@amd.com> (raw)
In-Reply-To: <20260627081657.499781-1-rhkrqnwk98@gmail.com>

Hello Sechang,

On 6/27/2026 1:46 PM, Sechang Lim wrote:
>  static inline void clear_tsk_need_resched(struct task_struct *tsk)
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b8871449d3c6..b358fac315d0 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1172,6 +1172,7 @@ static void __resched_curr(struct rq *rq, int tif)
>         struct task_struct *curr = rq->curr;
>         struct thread_info *cti = task_thread_info(curr);
>         int cpu;
> +       bool need_ipi;

nit. This declaration can go before "int cpu;" to preserve the
reverse x-mas arrangement for the independent variables.

> 
>         lockdep_assert_rq_held(rq);
> 
> @@ -1187,15 +1188,17 @@ static void __resched_curr(struct rq *rq, int tif)
> 
>         cpu = cpu_of(rq);
> 
> -       trace_sched_set_need_resched_tp(curr, cpu, tif);
>         if (cpu == smp_processor_id()) {
>                 set_ti_thread_flag(cti, tif);
>                 if (tif == TIF_NEED_RESCHED)
>                         set_preempt_need_resched();
> +               trace_sched_set_need_resched_tp(curr, cpu, tif);
>                 return;
>         }
> 
> -       if (set_nr_and_not_polling(cti, tif)) {
> +       need_ipi = set_nr_and_not_polling(cti, tif);
> +       trace_sched_set_need_resched_tp(curr, cpu, tif);

Unrelated to changes here: This tracepoint seems to be missing from
wake_up_idle_cpu() which modifies the ti->flags without taking the
rq_lock.

A newly enqueued timer can race with the wakeup on idle CPU and you can
see a wakeup + sched_switch without seeing a corresponding
trace_sched_set_need_resched_tp() for the CPU.

Gabriele, is that a concern for RV?

> +       if (need_ipi) {
>                 if (tif == TIF_NEED_RESCHED)
>                         smp_send_reschedule(cpu);
>         } else {
> --
> 2.43.0
> 

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-06-29  4:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-27  8:16 Sechang Lim
2026-06-29  4:11 ` K Prateek Nayak [this message]
2026-06-29 12:40   ` Gabriele Monaco
2026-06-29 17:35     ` K Prateek Nayak
2026-06-30  8:58       ` Gabriele Monaco
2026-06-30 16:16         ` K Prateek Nayak
2026-06-30 20:34           ` Peter Zijlstra
2026-07-01  6:51             ` K Prateek Nayak
2026-07-01  6:54               ` Peter Zijlstra
2026-07-01  8:09                 ` K Prateek Nayak
2026-07-01  8:49                   ` Peter Zijlstra
2026-07-16 15:09                     ` Will Deacon
2026-07-16 18:25                       ` K Prateek Nayak
2026-06-30  7:58   ` Sechang Lim

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=b8aca553-ee93-4b91-a428-f50d62da9ead@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gmonaco@redhat.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rhkrqnwk98@gmail.com \
    --cc=rostedt@goodmis.org \
    --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

all inboxes | Powered by JetHome®