X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fasm-i386%2Fmmzone.h;h=74f595d80579c275e103d0ac326b969e69561ab5;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=e33e9f9e4c6606b2b86d0cacdff42ba72f32944c;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h index e33e9f9e4..74f595d80 100644 --- a/include/asm-i386/mmzone.h +++ b/include/asm-i386/mmzone.h @@ -70,6 +70,8 @@ static inline int pfn_to_nid(unsigned long pfn) #endif } +#define node_localnr(pfn, nid) ((pfn) - node_data[nid]->node_start_pfn) + /* * Following are macros that each numa implmentation must define. */ @@ -84,6 +86,21 @@ static inline int pfn_to_nid(unsigned long pfn) /* XXX: FIXME -- wli */ #define kern_addr_valid(kaddr) (0) +#define pfn_to_page(pfn) \ +({ \ + unsigned long __pfn = pfn; \ + int __node = pfn_to_nid(__pfn); \ + &NODE_DATA(__node)->node_mem_map[node_localnr(__pfn,__node)]; \ +}) + +#define page_to_pfn(pg) \ +({ \ + struct page *__page = pg; \ + struct zone *__zone = page_zone(__page); \ + (unsigned long)(__page - __zone->zone_mem_map) \ + + __zone->zone_start_pfn; \ +}) + #ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */ #define pfn_valid(pfn) ((pfn) < num_physpages) #else