Re: [PATCH] rmap 13a

William Lee Irwin III
2002-05-08T21:50:01Z

On Wed, May 08, 2002 at 08:21:37PM +0200, Roman Zippel wrote:
> I'd suggest, we move page_address to asm/page.h (as counterpart of
> virt_to_page). discontigmem configs can then use some more efficient
> table lookup. Other config usually want to implement it better as:
> #define page_address(page) ((((page) - mem_map) << PAGE_SHIFT) +
> PAGE_OFFSET)
> bye, Roman

Sorry, I missed the part about table lookup.

If table lookup is wanted, I feel that should also be a generic option.
There is nothing inherently architecture-specific about using a table-
driven method of calculating page_address().

But why isn't zone_table[] already an instance of such a table?

An annotated description of the generic version is:

/* the table lookup */
zone = zone_table[page->flags >> ZONE_SHIFT]

/* the phys offset of the table entry */
__va(zone->zone_start_paddr
+
/* calculating the offset within the table region */ /* scaling the offset */
((page - zone->zone_mem_map) << PAGE_SHIFT))

Cheers,
Bill