Cc: Zhang, Yanmin <yanmin_zhang@...>, Andi Kleen <andi@...>, Matthew Wilcox <matthew@...>, LKML <linux-kernel@...>, Alexander Viro <viro@...>, Andrew Morton <akpm@...>, Thomas Gleixner <tglx@...>, H. Peter Anvin <hpa@...>, Alan Cox <alan@...>
Btw, sparse will complain about those, because the source code *looks*
really cheap.
The normal "page_to_pfn()" looks trivial:
((unsigned long)((page) - mem_map) + ARCH_PFN_OFFSET)
which looks like a trivial subtraction and addition of a constant, but the
subtraction is on C pointers, and basically turns into
((unsigned long)page - (unsigned long)mem_map) / sizeof(struct page)
and because "struct page" is not some nice power-of-two in size, that
division is rather nasty even though it's a constant size.
Linus
--