lkml.org 
[lkml]   [2010]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 12/35] workqueue: update cwq alignement
On Tue, Jun 29, 2010 at 09:39:41AM +0200, Tejun Heo wrote:
> Hello,
>
> On 06/29/2010 12:47 AM, Frederic Weisbecker wrote:
> >> void __init init_workqueues(void)
> >> {
> >> + /*
> >> + * cwqs are forced aligned according to WORK_STRUCT_FLAG_BITS.
> >> + * Make sure that the alignment isn't lower than that of
> >> + * unsigned long long.
> >> + */
> >> + BUILD_BUG_ON(__alignof__(struct cpu_workqueue_struct) <
> >> + __alignof__(unsigned long long));
> >> +
> >
> > But they are not allocated contiguously as we use the per cpu offsets.
> > So why does the struct itself need to be aligned? Only the base pointer
> > of its dynamic allocation needs to be aligned. Or am I missing something?
>
> work->data doesn't store the percpu pointer but the address of cwq of
> that specific cpu as returned by per_cpu_ptr(), so each element needs
> to be aligned. Besides, if the percpu ptr is aligned the elements are
> aligned so they aren't different things.



But then, if each cpu pointers are aligned, the struct itself doesn't need
to be aligned in its size right? It would need to if multiple elements
were allocated per cpu but for this struct we only have one per cpu. So
what seems to matter wrt alignment is only the base pointer of these structs,
not the size.



\
 
 \ /
  Last update: 2010-06-29 14:39    [W:0.088 / U:0.484 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site