lkml.org 
[lkml]   [2008]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] generic smp function call: add multiple queues for scaling
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


\
 
 \ /
  Last update: 2008-07-30 02:47    [W:0.044 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site