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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1809071445580.1402@nanos.tec.linutronix.de>
Date:   Fri, 7 Sep 2018 14:47:25 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Dou Liyang <dou_liyang@....com>
cc:     linux-kernel@...r.kernel.org, x86@...nel.org, mingo@...hat.com,
        hpa@...or.com, douly.fnst@...fujitsu.com
Subject: Re: [PATCH 2/2] irq/matrix: Spread managed interrupts on
 allocation

On Fri, 7 Sep 2018, Dou Liyang wrote:
> -int irq_matrix_alloc_managed(struct irq_matrix *m, unsigned int cpu)
> +int irq_matrix_alloc_managed(struct irq_matrix *m, const struct cpumask *msk,
> +				unsigned int *mapped_cpu)
>  {
> -	struct cpumap *cm = per_cpu_ptr(m->maps, cpu);
>  	unsigned int bit, end = m->alloc_end;
> +	unsigned int best_cpu = UINT_MAX;
> +	struct cpumap *cm;
>  
> -	/* Get managed bit which are not allocated */
> -	bitmap_andnot(m->scratch_map, cm->managed_map, cm->alloc_map, end);
> -	bit = find_first_bit(m->scratch_map, end);
> -	if (bit >= end)
> -		return -ENOSPC;
> -	set_bit(bit, cm->alloc_map);
> -	cm->allocated++;
> -	m->total_allocated++;
> -	trace_irq_matrix_alloc_managed(bit, cpu, m, cm);
> -	return bit;
> +	if (matrix_find_best_cpu(m, msk, &best_cpu)) {

You can avoid that churn and the extra indentation by simply doing:

	if (!matrix_find_best_cpu(m, msk, &best_cpu))
		return -ENOSPC;

Hmm?

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ