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: <20201007165533.GL2628@hirez.programming.kicks-ass.net>
Date:   Wed, 7 Oct 2020 18:55:33 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Peng Liu <iwtbavbm@...il.com>
Cc:     linux-kernel@...r.kernel.org, mingo@...hat.com,
        juri.lelli@...hat.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
        mgorman@...e.de, bristot@...hat.com, valentin.schneider@....com,
        raistlin@...ux.it
Subject: Re: [PATCH v5 1/2] sched/deadline: optimize
 sched_dl_global_validate()

On Wed, Oct 07, 2020 at 11:12:29PM +0800, Peng Liu wrote:
> +/* Used for dl_bw check and update. */
> +static u32 dl_generation;

> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 28709f6b0975..53477e8b26b0 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -798,6 +798,13 @@ struct root_domain {
>  	 */
>  	cpumask_var_t		dlo_mask;
>  	atomic_t		dlo_count;
> +
> +	/*
> +	 * Indicate whether a root_domain's dl_bw has been checked or
> +	 * updated. It's monotonously increasing, then wrap around.
> +	 */
> +	u32 visit_gen;
> +
>  	struct dl_bw		dl_bw;
>  	struct cpudl		cpudl;
>  
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index dd7770226086..90f3e5558fa2 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -516,6 +516,7 @@ static int init_rootdomain(struct root_domain *rd)
>  	init_irq_work(&rd->rto_push_work, rto_push_irq_work_func);
>  #endif
>  
> +	rd->visit_gen = 0;
>  	init_dl_bw(&rd->dl_bw);
>  	if (cpudl_init(&rd->cpudl) != 0)
>  		goto free_rto_mask;

I'm fairly sure I made the generation a u64, the above is susceptible to
a false positive due to wrap-around.

Increase the generation to -1, create a new root domain, then the next
generation is 0 and we'll skip the new domain, even though it should be
updated.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ