![]() | ||||||||||
Messages in this thread |
On Thu, 8 May 2008, Linus Torvalds wrote: > > Some of it is that "page_to_pfn(page)", which involves a nasty division > (divide by sizeof(struct page)). It gets turned into that shift and > multiply, but it's still quite expensive with big constants etc. 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | |||||||||
| Last update: 2008-05-08 23:11 [W:0.162 / U:0.290 seconds] ©2003-2008 Jasper Spaans | ||||||||||