lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0911287d-b936-4a3d-af24-76c351393b5b@gmail.com>
Date: Mon, 16 Jun 2025 20:10:18 +0800
From: xieliujie <xieliujie92@...il.com>
To: mingo@...hat.com, peterz@...radead.org
Cc: linux-kernel@...r.kernel.org, LiuJie Xie <xieliujie@...omi.com>
Subject: Re: [PATCH] sched/rt: Update wait_time when doing migration.

[ping]

在 2025/4/14 19:48, LiuJie Xie 写道:
> From: LiuJie Xie <xieliujie@...omi.com>
> 
> With __update_stats_wait_start() and __update_stats_wait_end(), we track
> task's latency and the info can be seen in proc node '/proc/pid/sched'.
> But it seems that we loss updating wait_time when rt task doing migration.
> In update_stats_dequeue_fair() by calling update_stats_wait_end_fair(), the
> fair sched class make this update work.
> 
> When a rt doing migration, we can see:
> step1: wait_start=1503718063442 C:(__update_stats_wait_start<-ttwu_do_activate<-try_to_wake_up)
> step2: wait_start=124844 C:(__update_stats_wait_start<-activate_task<-push_rt_task<-push_rt_tasks<-finish_task_switch)
> step3: wait_start=124844 delta=1503718120473 C:(__update_stats_wait_end<-__schedule<-schedule)
> 
> In step2, the wait_start become very small after doing the below logic
> and we will get a very big delta in step3.
> void __update_stats_wait_start()
> {
>      prev_wait_start = schedstat_val(stats->wait_start);
> 
>      if (p && likely(wait_start > prev_wait_start))
>              wait_start -= prev_wait_start;
> 
>      __schedstat_set(stats->wait_start, wait_start);
> }
> 
> So, update_stats_dequeue_rt() should also update wait_time just like
> fair to get the correct delta.
> 
> Signed-off-by: LiuJie Xie <xieliujie@...omi.com>
> ---
>   kernel/sched/rt.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index fa03ec3ed56a..a93d23b839ad 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1346,6 +1346,13 @@ update_stats_dequeue_rt(struct rt_rq *rt_rq, struct sched_rt_entity *rt_se,
>   	if (rt_entity_is_task(rt_se))
>   		p = rt_task_of(rt_se);
>   
> +	/*
> +	 * Mark the end of the wait period if dequeueing a
> +	 * waiting task:
> +	 */
> +	if (p && !task_on_cpu(task_rq(p), p))
> +		update_stats_wait_end_rt(rt_rq, rt_se);
> +
>   	if ((flags & DEQUEUE_SLEEP) && p) {
>   		unsigned int state;
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ