public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] generic smp function call: add multiple queues for scaling
Date: Tue, 29 Jul 2008 17:44:38 -0700	[thread overview]
Message-ID: <488FB976.7080803@goop.org> (raw)
In-Reply-To: <20080730002603.GB23938@one.firstfloor.org>

Andi Kleen wrote:
> 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? 
>   

Hm, that's a point.  I guess the __cacheline_aligned_in_smp should be on 
the struct definition.

>> +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.
>   

Are you sure?  I tried using it, but couldn't work out how.  Remember 
the list head init needs to point to itself, which means it's not 
constant across the array.

    J

      reply	other threads:[~2008-07-30  0:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-29 23:32 [PATCH 1/2] generic smp function call: add multiple queues for scaling Jeremy Fitzhardinge
2008-07-30  0:26 ` Andi Kleen
2008-07-30  0:44   ` Jeremy Fitzhardinge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=488FB976.7080803@goop.org \
    --to=jeremy@goop.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox