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] [thread-next>] [day] [month] [year] [list]
Message-ID: <8136b9a7-480d-4d47-aca1-adf0c7d90d21@bytedance.com>
Date: Mon, 4 Mar 2024 20:06:16 +0800
From: Abel Wu <wuyun.abel@...edance.com>
To: Tianchen Ding <dtcccc@...ux.alibaba.com>, linux-kernel@...r.kernel.org
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>, Valentin Schneider <vschneid@...hat.com>
Subject: Re: [PATCH 2/2] sched/eevdf: Fix miscalculation in reweight_entity()
 when se is not curr

On 3/4/24 11:00 AM, Tianchen Ding Wrote:
> reweight_eevdf() only keeps V unchanged inside itself. When se !=
> cfs_rq->curr, it would be dequeued from rb tree first. So that V is
> changed and the result is wrong. Pass the original V to reweight_eevdf()
> to fix this issue.
> 
> Fixes: eab03c23c2a1 ("sched/eevdf: Fix vruntime adjustment on reweight")
> Signed-off-by: Tianchen Ding <dtcccc@...ux.alibaba.com>
> ---
>   kernel/sched/fair.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 5551ce2af73e..091a1a750638 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3676,11 +3676,10 @@ static inline void
>   dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { }
>   #endif
>   
> -static void reweight_eevdf(struct cfs_rq *cfs_rq, struct sched_entity *se,
> +static void reweight_eevdf(struct sched_entity *se, u64 avruntime,
>   			   unsigned long weight)
>   {
>   	unsigned long old_weight = se->load.weight;
> -	u64 avruntime = avg_vruntime(cfs_rq);
>   	s64 vlag, vslice;
>   
>   	/*
> @@ -3787,10 +3786,12 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>   			    unsigned long weight)
>   {
>   	bool curr = cfs_rq->curr == se;
> +	u64 avruntime;
>   
>   	if (se->on_rq) {
>   		/* commit outstanding execution time */
>   		update_curr(cfs_rq);
> +		avruntime = avg_vruntime(cfs_rq);
>   		if (!curr)
>   			__dequeue_entity(cfs_rq, se);
>   		update_load_sub(&cfs_rq->load, se->load.weight);
> @@ -3804,7 +3805,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>   		 */
>   		se->vlag = div_s64(se->vlag * se->load.weight, weight);
>   	} else {
> -		reweight_eevdf(cfs_rq, se, weight);
> +		reweight_eevdf(se, avruntime, weight);
>   	}
>   
>   	update_load_set(&se->load, weight);

Reviewed-by: Abel Wu <wuyun.abel@...edance.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ