Re: [PATCH 12/35] workqueue: update cwq alignement

From: Tejun Heo
Date: Tue Jun 29 2010 - 12:11:43 EST


On 06/29/2010 06:01 PM, Frederic Weisbecker wrote:
> So, imagine you allocate your struct with alloc_percpu(align).
> The per cpu pointer is 0x400 (purely imagination).
> Now you have two cpus and they have the following base offsets for
> per cpu allocations:
> CPU 0 = 0xf1000000
> CPU 1 = 0xf2000000
> So, the true pointers for your cpu workqueue structs will be:
> CPU 0 = 0xf1000400
> CPU 1 = 0xf2000400
> These addresses are aligned like you wanted to, and it seems it is what
> matters, to store these addresses in the work flags.


> So why does the size of the struct need to be aligned too?

Where am I doing that?

> All you want is that the two above addresses are aligned. Now why
> the size of the struct itself needs this alignment too. That's the
> obscure point for me. If it's useless, this could avoid all this
> alignment maintainance, except during the allocation itself.

What alignment maintenance? Are you talking about the UP code? If
you're talking about the UP code, the ugliness there is because the
current UP __alloc_percpu() can't honor the alignment parameter.

Heh, it seems I'm still lost. Care to give one more shot at it? :-)


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at