The patch titled include/asm-generic/page.h: calculate virt_to_page and page_to_virt via predefined macro has been added to the -mm tree. Its filename is include-asm-generic-pageh-calculate-virt_to_page-and-page_to_virt-via-predefined-macro.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: include/asm-generic/page.h: calculate virt_to_page and page_to_virt via predefined macro From: Sonic Zhang <sonic.zhang@xxxxxxxxxx> On NOMMU architectures, if physical memory doesn't start from 0, ARCH_PFN_OFFSET is defined to generate page index in mem_map array. Because virtual address is equal to physical address, PAGE_OFFSET is always 0. virt_to_page and page_to_virt should not index page by PAGE_OFFSET directly. Signed-off-by: Sonic Zhang <sonic.zhang@xxxxxxxxxx> Cc: Greg Ungerer <gerg@xxxxxxxxxxxx> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: David Howells <dhowells@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-generic/page.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN include/asm-generic/page.h~include-asm-generic-pageh-calculate-virt_to_page-and-page_to_virt-via-predefined-macro include/asm-generic/page.h --- a/include/asm-generic/page.h~include-asm-generic-pageh-calculate-virt_to_page-and-page_to_virt-via-predefined-macro +++ a/include/asm-generic/page.h @@ -79,8 +79,8 @@ extern unsigned long memory_end; #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) -#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)) -#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) +#define virt_to_page(addr) pfn_to_page(virt_to_pfn(addr)) +#define page_to_virt(page) pfn_to_virt(page_to_pfn(page)) #ifndef page_to_phys #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) _ Patches currently in -mm which might be from sonic.zhang@xxxxxxxxxx are include-asm-generic-pageh-calculate-virt_to_page-and-page_to_virt-via-predefined-macro.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html