some questions about block and scatterlist

Dave Hylands dhylands at gmail.com
Mon Nov 7 12:08:03 EST 2011


Hi loody,

On Mon, Nov 7, 2011 at 5:16 AM, loody <miloody at gmail.com> wrote:
...snip...
>>> 1. Are all struct page 32-bit aligned?
>>
>> Certainly, I would expect any structures found in the system memory map to
>> be so aligned, yes.  If you've created an arbitrary one elsewhere I'm only
>> 99% sure it would be.
>>
>>> If so, where is this part of code for handleing struct page be 32-bits aligned?
>>
>> Note that the size of struct page is carefully considered, and that they
>> are packed as densely as possible, both externally and internally.  No
>> lesser alignment would make sense.
> I found kernel stealing LSB of page_link to put additional
> information, such as sg_is_chain and sg_is_last.
>
> That means the address of all pages have to be at least 4byte alignment.
> But I didn't see any additional attribute added at the end of struct
> or any precaution to take care this.

This is done automatically by the compiler.
http://en.wikipedia.org/wiki/Data_structure_alignment

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com



More information about the Kernelnewbies mailing list