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

Dave Hansen
2007-08-02T16:56:28Z

On Thu, 2007-08-02 at 18:39 +0100, Andy Whitcroft wrote:
> 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.

Are you saying that it isn't PAGE_MASK (((unsigned long)page)&PAGE_MASK
== page) aligned. Or, that it isn't sizeof(struct page) aligned?

> +unsigned long __meminit vmemmap_section_start(struct page *page)
...
> @@ -204,7 +209,7 @@ int __meminit vmemmap_populated(unsigned long start, int page_size)
> unsigned long end = start + page_size;
>
> for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page)))
> - if (pfn_valid(VMM_SECTION_PAGE(start)))
> + if (pfn_valid(vmemmap_section_start(start)))
> return 1;

If "start" is an "unsigned long", why is it being passed into a function
that takes a "struct page"?

I think the types are confusing me a bit.

-- Dave