Re: [PATCH] Cast page_to_pfn to unsigned long in CONFIG_SPARSEMEM

Dave Hansen
2007-11-19T21:19:57Z

On Mon, 2007-11-19 at 13:08 -0800, Andrew Morton wrote:
>
> > #else
> > -#define page_to_pfn __page_to_pfn
> > +#define page_to_pfn ((unsigned long)__page_to_pfn)
> > #define pfn_to_page __pfn_to_page
> > #endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
>
> I'd have thought that __pfn_to_page() was the place to fix this: the
> lower-level point. Because someone might later start using
> __pfn_to_page()
> for something.
>
> Heaven knows why though - why does __pfn_to_page() even exist?

I think it's this stuff:

#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
struct page *pfn_to_page(unsigned long pfn)
{
return __pfn_to_page(pfn);
}
unsigned long page_to_pfn(struct page *page)
{
return __page_to_pfn(page);
}
EXPORT_SYMBOL(pfn_to_page);
EXPORT_SYMBOL(page_to_pfn);
#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */

Which comes from:

config OUT_OF_LINE_PFN_TO_PAGE
def_bool X86_64
depends on DISCONTIGMEM

and only on x86_64. Perhaps it can go away with the
discontig->sparsemem-vmemmap conversion.

-- Dave