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  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]
Date:   Sun, 2 Sep 2018 21:27:16 -0700
From:   Dietmar Eggemann <dietmar.eggemann@....com>
To:     Steve Muckle <smuckle@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>
Cc:     linux-kernel@...r.kernel.org, kernel-team@...roid.com,
        Todd Kjos <tkjos@...gle.com>, Paul Turner <pjt@...gle.com>,
        Quentin Perret <quentin.perret@....com>,
        Patrick Bellasi <Patrick.Bellasi@....com>,
        Chris Redpath <Chris.Redpath@....com>,
        Morten Rasmussen <Morten.Rasmussen@....com>,
        Miguel de Dios <migueldedios@...gle.com>,
        John Dias <joaodias@...gle.com>
Subject: Re: [PATCH] sched/fair: fix vruntime_normalized for remote
 non-migration wakeup

On 08/31/2018 03:42 PM, Steve Muckle wrote:
> When a task which previously ran on a given CPU is remotely queued to
> wake up on that same CPU, there is a period where the task's state is
> TASK_WAKING and its vruntime is not normalized. This is not accounted
> for in vruntime_normalized() which will cause an
> error in the task's vruntime if it is switched from the fair class
> during this time, for example if it is boosted to RT priority via
> rt_mutex_setprio. The rq's min_vruntime will not be subtracted from the
> task's vruntime but it will be added again when the task returns to the
> fair class. The task's vruntime will have been erroneously doubled and
> the effective priority of the task will be reduced.
> 
> Note this will also lead to inflation of all vruntimes since the doubled
> vruntime value will become the rq's min_vruntime when other tasks leave
> the rq. This leads to repeated doubling of the vruntime and priority
> penalty.
> 
> Fix this by recognizing a WAKING task's vruntime as normalized only if
> sched_remote_wakeup is true. This indicates a migration, in which case
> the vruntime would have been normalized in migrate_task_rq_fair().
> 
> Based on a similar patch from joaodias@...gle.com.
> 
> Suggested-by: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Steve Muckle <smuckle@...gle.com>
> ---
>   kernel/sched/fair.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b39fb596f6c1..b3b62cf37fb6 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9638,7 +9638,8 @@ static inline bool vruntime_normalized(struct task_struct *p)
>   	 * - A task which has been woken up by try_to_wake_up() and
>   	 *   waiting for actually being woken up by sched_ttwu_pending().
>   	 */
> -	if (!se->sum_exec_runtime || p->state == TASK_WAKING)
> +	if (!se->sum_exec_runtime ||
> +	    (p->state == TASK_WAKING && p->sched_remote_wakeup))
>   		return true;
>   
>   	return false;
> 

Tested-by: Dietmar Eggemann <dietmar.eggemann@....com>

Powered by blists - more mailing lists