Re: [PATCH 4/4] vmemmap ppc64: convert VMM_* macros to a real function

Andy Whitcroft
2007-08-02T17:39:57Z

Dave Hansen wrote:
> On Thu, 2007-08-02 at 10:25 +0100, Andy Whitcroft wrote:
>> +unsigned long __meminit vmemmap_section_start(struct page *page)
>> +{
>> + unsigned long offset = ((unsigned long)page) -
>> + ((unsigned long)(vmemmap));
>
> Isn't this basically page_to_pfn()? Can we use it here?

No, as that does direct subtraction of the two pointers. Our 'page'
here is not guarenteed to be aligned even to a struct page boundary.
When it is not so aligned the subtraction of the pointers is undefined.
Indeed when you do subtract them when the 'page' is not aligned you get
complete gibberish back and blammo's result.

-apw