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: <20080730002603.GB23938@one.firstfloor.org>
Date:	Wed, 30 Jul 2008 02:26:03 +0200
From:	Andi Kleen <andi@...stfloor.org>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Nick Piggin <nickpiggin@...oo.com.au>,
	Andi Kleen <andi@...stfloor.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] generic smp function call: add multiple queues for scaling

Ah I see the locking is here. Never mind the earlier comment.

> +#define	NQUEUES	CONFIG_GENERIC_SMP_QUEUES
> +#else
> +#define	NQUEUES	1
> +#endif
> +
> static DEFINE_PER_CPU(struct call_single_queue, call_single_queue);
> -static LIST_HEAD(call_function_queue);
> -__cacheline_aligned_in_smp DEFINE_SPINLOCK(call_function_lock);
> +struct queue {
> +	struct list_head list;
> +	spinlock_t lock;
> +};
> +
> +static __cacheline_aligned_in_smp struct queue 
> call_function_queues[NQUEUES];

Hmm are you sure this aligns the individual elements and not the whole
array? 

> void ipi_call_unlock(void)
> {
> -	spin_unlock(&call_function_lock);
> +	int i;
> +
> +	for(i = 0; i < NQUEUES; i++)
> +		spin_unlock(&call_function_queues[i].lock);
> }
> 
> void ipi_call_lock_irq(void)
> {
> -	spin_lock_irq(&call_function_lock);
> +	int i;
> +
> +	for(i = 0; i < NQUEUES; i++)
> +		spin_lock_irq(&call_function_queues[i].lock);
> }
> 
> void ipi_call_unlock_irq(void)
> {
> -	spin_unlock_irq(&call_function_lock);
> +	int i;
> +
> +	for(i = 0; i < NQUEUES; i++)
> +		spin_unlock_irq(&call_function_queues[i].lock);
> }
> +
> +
> +static int __init init_smp_function_call(void)
> +{
> +	int i;
> +
> +	for(i = 0; i < NQUEUES; i++) {
> +		INIT_LIST_HEAD(&call_function_queues[i].list);
> +		spin_lock_init(&call_function_queues[i].lock);
> +	}
> +
> +	return 0;
> +}
> +early_initcall(init_smp_function_call);

You can avoid all that init gunk by using the [0 ... NQUEUES] = ..
gcc extension in the initializer.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ