Commit cee396e2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] cleanup and generalise lowmem_page_address

From: William Lee Irwin III <wli@holomorphy.com>

This patch allows architectures to micro-optimize lowmem_page_address() at
their whims.  Roman Zippel originally wrote and/or suggested this back when
dependencies on page->virtual existing were being shaken out.  That's
long-settled, so it's fine to do this now.
parent 32717367
...@@ -339,9 +339,14 @@ static inline void set_page_zone(struct page *page, unsigned long zone_num) ...@@ -339,9 +339,14 @@ static inline void set_page_zone(struct page *page, unsigned long zone_num)
page->flags |= zone_num << ZONE_SHIFT; page->flags |= zone_num << ZONE_SHIFT;
} }
static inline void * lowmem_page_address(struct page *page) #ifndef CONFIG_DISCONTIGMEM
/* The array of struct pages - for discontigmem use pgdat->lmem_map */
extern struct page *mem_map;
#endif
static inline void *lowmem_page_address(struct page *page)
{ {
return __va( ( (page - page_zone(page)->zone_mem_map) + page_zone(page)->zone_start_pfn) << PAGE_SHIFT); return __va(page_to_pfn(page) << PAGE_SHIFT);
} }
#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
...@@ -395,11 +400,6 @@ static inline int page_mapped(struct page *page) ...@@ -395,11 +400,6 @@ static inline int page_mapped(struct page *page)
#define VM_FAULT_MINOR 1 #define VM_FAULT_MINOR 1
#define VM_FAULT_MAJOR 2 #define VM_FAULT_MAJOR 2
#ifndef CONFIG_DISCONTIGMEM
/* The array of struct pages - for discontigmem use pgdat->lmem_map */
extern struct page *mem_map;
#endif
extern void show_free_areas(void); extern void show_free_areas(void);
struct page *shmem_nopage(struct vm_area_struct * vma, struct page *shmem_nopage(struct vm_area_struct * vma,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment