From: Peter Zijlstra <peterz@infradead.org>
To: Olice Zou <zoucaox@gmail.com>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
linux-kernel@vger.kernel.org, Olice Zou <olicezou@tencent.com>
Subject: Re: [PATCH] sched/stats: TASK_IDLE task bypass the block_starts time
Date: Fri, 20 Jun 2025 10:55:11 +0200 [thread overview]
Message-ID: <20250620085511.GQ1613376@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250620031450.581290-1-olicezou@tencent.com>
On Fri, Jun 20, 2025 at 11:14:50AM +0800, Olice Zou wrote:
> For TASK_IDLE task, we not should record the block_starts, it is
> not real TASK_UNINTERRUPTIBLE task.
Why, I mean it is still blocked, right?
> It is easy to find this problem in a idle machine as followe:
>
> bpftrace -e 'tracepoint:sched:sched_stat_blocked { \
> if (args->delay > 1000000) \
> { \
> printf("%s %d\n", args->comm, args->delay); \
> print(kstack()); \
> } \
> }
>
> rcu_preempt 3881764
> __update_stats_enqueue_sleeper+604
> __update_stats_enqueue_sleeper+604
> enqueue_entity+1014
> enqueue_task_fair+156
> activate_task+109
> ttwu_do_activate+111
> try_to_wake_up+615
> wake_up_process+25
> process_timeout+22
> call_timer_fn+44
> run_timer_softirq+1100
> handle_softirqs+178
> irq_exit_rcu+113
> sysvec_apic_timer_interrupt+132
> asm_sysvec_apic_timer_interrupt+31
> pv_native_safe_halt+15
> arch_cpu_idle+13
> default_idle_call+48
> do_idle+516
> cpu_startup_entry+49
> start_secondary+280
> secondary_startup_64_no_verify+404
Not sure what I'm looking at there. What is the problem?
> Signed-off-by: Olice Zou <olicezou@tencent.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a85539df75a5..e473e3244dda 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1285,7 +1285,7 @@ update_stats_dequeue_fair(struct cfs_rq *cfs_rq, struct sched_entity *se, int fl
> if (state & TASK_INTERRUPTIBLE)
> __schedstat_set(tsk->stats.sleep_start,
> rq_clock(rq_of(cfs_rq)));
> - if (state & TASK_UNINTERRUPTIBLE)
> + if (state != TASK_IDLE && (state & TASK_UNINTERRUPTIBLE))
> __schedstat_set(tsk->stats.block_start,
> rq_clock(rq_of(cfs_rq)));
> }
> --
> 2.25.1
>
next prev parent reply other threads:[~2025-06-20 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 3:14 Olice Zou
2025-06-20 8:55 ` Peter Zijlstra [this message]
2025-06-23 6:34 ` zoucao
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=20250620085511.GQ1613376@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=olicezou@tencent.com \
--cc=vincent.guittot@linaro.org \
--cc=zoucaox@gmail.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®