linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx
@ 2012-06-06  8:14 Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 2/7] highmem: rearrange the comments of pkmap_count Lai Jiangshan
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:14 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan

make it near to its defintion.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 mm/highmem.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/mm/highmem.c b/mm/highmem.c
index 57d82c6..0036dd5 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -32,6 +32,7 @@
 
 #if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
 DEFINE_PER_CPU(int, __kmap_atomic_idx);
+EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx);
 #endif
 
 /*
@@ -47,9 +48,6 @@ DEFINE_PER_CPU(int, __kmap_atomic_idx);
 unsigned long totalhigh_pages __read_mostly;
 EXPORT_SYMBOL(totalhigh_pages);
 
-
-EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx);
-
 unsigned int nr_free_highpages (void)
 {
 	pg_data_t *pgdat;
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/7] highmem: rearrange the comments of pkmap_count
  2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
@ 2012-06-06  8:14 ` Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 3/7] highmem: remove set_page_address() Lai Jiangshan
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:14 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan

make it near to its defintion.
also change Virtual_count to pkmap_count in the comments.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 mm/highmem.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mm/highmem.c b/mm/highmem.c
index 0036dd5..54c0521 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -35,14 +35,6 @@ DEFINE_PER_CPU(int, __kmap_atomic_idx);
 EXPORT_PER_CPU_SYMBOL(__kmap_atomic_idx);
 #endif
 
-/*
- * Virtual_count is not a pure "count".
- *  0 means that it is not mapped, and has not been mapped
- *    since a TLB flush - it is usable.
- *  1 means that there are no users, but it has been mapped
- *    since the last TLB flush - so we can't use it.
- *  n means that there are (n-1) current users of it.
- */
 #ifdef CONFIG_HIGHMEM
 
 unsigned long totalhigh_pages __read_mostly;
@@ -65,6 +57,14 @@ unsigned int nr_free_highpages (void)
 	return pages;
 }
 
+/*
+ * pkmap_count is not a pure "count".
+ *  0 means that it is not mapped, and has not been mapped
+ *    since a TLB flush - it is usable.
+ *  1 means that there are no users, but it has been mapped
+ *    since the last TLB flush - so we can't use it.
+ *  n means that there are (n-1) current users of it.
+ */
 static int pkmap_count[LAST_PKMAP];
 static unsigned int last_pkmap_nr;
 static  __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/7] highmem: remove set_page_address()
  2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 2/7] highmem: rearrange the comments of pkmap_count Lai Jiangshan
@ 2012-06-06  8:14 ` Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 4/7] highmem: remove pool_lock Lai Jiangshan
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:14 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan

First, highmem.c:set_page_address() is not used by any one outside.
o	So we can make it as a static/internal function in highmem.c.

Second, highmem.c:set_page_address() allocated struct page_address_map
from page_address_maps[], but page_address_maps[] is just sufficient for
kmap() usages, it means, if set_page_address() is called from outside,
it will break kmap() and trigger a BUG_ON().
o	So we should make it as a static/internal function in highmem.c.

Result:

highmem.c:set_page_address() is renamed to set_high_page_address()
and it becomes internal function. (it will be changed again in later patch)

page_alloc.c also calls a different variant of set_page_address(),
we rename it to set_page_virtual_address().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 include/linux/mm.h |    4 +---
 mm/highmem.c       |   10 ++++++----
 mm/page_alloc.c    |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 134abf3..8e0a1c1 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -747,7 +747,7 @@ static __always_inline void *lowmem_page_address(const struct page *page)
 
 #if defined(WANT_PAGE_VIRTUAL)
 #define page_address(page) ((page)->virtual)
-#define set_page_address(page, address)			\
+#define set_page_virtual_address(page, address)		\
 	do {						\
 		(page)->virtual = (address);		\
 	} while(0)
@@ -756,13 +756,11 @@ static __always_inline void *lowmem_page_address(const struct page *page)
 
 #if defined(HASHED_PAGE_VIRTUAL)
 void *page_address(const struct page *page);
-void set_page_address(struct page *page, void *virtual);
 void page_address_init(void);
 #endif
 
 #if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL)
 #define page_address(page) lowmem_page_address(page)
-#define set_page_address(page, address)  do { } while(0)
 #define page_address_init()  do { } while(0)
 #endif
 
diff --git a/mm/highmem.c b/mm/highmem.c
index 54c0521..b6ce085 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -92,6 +92,8 @@ static DECLARE_WAIT_QUEUE_HEAD(pkmap_map_wait);
 		do { spin_unlock(&kmap_lock); (void)(flags); } while (0)
 #endif
 
+static void set_high_page_address(struct page *page, void *virtual);
+
 static void flush_all_zero_pkmaps(void)
 {
 	int i;
@@ -126,7 +128,7 @@ static void flush_all_zero_pkmaps(void)
 		pte_clear(&init_mm, (unsigned long)page_address(page),
 			  &pkmap_page_table[i]);
 
-		set_page_address(page, NULL);
+		set_high_page_address(page, NULL);
 		need_flush = 1;
 	}
 	if (need_flush)
@@ -188,7 +190,7 @@ start:
 		   &(pkmap_page_table[last_pkmap_nr]), mk_pte(page, kmap_prot));
 
 	pkmap_count[last_pkmap_nr] = 1;
-	set_page_address(page, (void *)vaddr);
+	set_high_page_address(page, (void *)vaddr);
 
 	return vaddr;
 }
@@ -365,11 +367,11 @@ done:
 EXPORT_SYMBOL(page_address);
 
 /**
- * set_page_address - set a page's virtual address
+ * set_high_page_address - set a page's virtual address
  * @page: &struct page to set
  * @virtual: virtual address to use
  */
-void set_page_address(struct page *page, void *virtual)
+static void set_high_page_address(struct page *page, void *virtual)
 {
 	unsigned long flags;
 	struct page_address_slot *pas;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 476ae3e..75d171b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3727,7 +3727,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
 #ifdef WANT_PAGE_VIRTUAL
 		/* The shift won't overflow because ZONE_NORMAL is below 4G. */
 		if (!is_highmem_idx(zone))
-			set_page_address(page, __va(pfn << PAGE_SHIFT));
+			set_page_virtual_address(page, __va(pfn << PAGE_SHIFT));
 #endif
 	}
 }
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/7] highmem: remove pool_lock
  2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 2/7] highmem: rearrange the comments of pkmap_count Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 3/7] highmem: remove set_page_address() Lai Jiangshan
@ 2012-06-06  8:14 ` Lai Jiangshan
  2012-06-06  8:14 ` [PATCH 5/7] highmem: direct struct page_address_map allocation Lai Jiangshan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:14 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan


The accesses to the pool are always in kmap_lock critical region,
thus pool_lock is not needed.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 mm/highmem.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/mm/highmem.c b/mm/highmem.c
index b6ce085..bf7f168 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -316,7 +316,6 @@ struct page_address_map {
  * page_address_map freelist, allocated from page_address_maps.
  */
 static struct list_head page_address_pool;	/* freelist */
-static spinlock_t pool_lock;			/* protects page_address_pool */
 
 /*
  * Hash table bucket
@@ -383,11 +382,9 @@ static void set_high_page_address(struct page *page, void *virtual)
 	if (virtual) {		/* Add */
 		BUG_ON(list_empty(&page_address_pool));
 
-		spin_lock_irqsave(&pool_lock, flags);
 		pam = list_entry(page_address_pool.next,
 				struct page_address_map, list);
 		list_del(&pam->list);
-		spin_unlock_irqrestore(&pool_lock, flags);
 
 		pam->page = page;
 		pam->virtual = virtual;
@@ -401,9 +398,7 @@ static void set_high_page_address(struct page *page, void *virtual)
 			if (pam->page == page) {
 				list_del(&pam->list);
 				spin_unlock_irqrestore(&pas->lock, flags);
-				spin_lock_irqsave(&pool_lock, flags);
 				list_add_tail(&pam->list, &page_address_pool);
-				spin_unlock_irqrestore(&pool_lock, flags);
 				goto done;
 			}
 		}
@@ -426,7 +421,6 @@ void __init page_address_init(void)
 		INIT_LIST_HEAD(&page_address_htable[i].lh);
 		spin_lock_init(&page_address_htable[i].lock);
 	}
-	spin_lock_init(&pool_lock);
 }
 
 #endif	/* defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) */
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/7] highmem: direct struct page_address_map allocation
  2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
                   ` (2 preceding siblings ...)
  2012-06-06  8:14 ` [PATCH 4/7] highmem: remove pool_lock Lai Jiangshan
@ 2012-06-06  8:14 ` Lai Jiangshan
  2012-06-06  8:15 ` [PATCH 6/7] highmem: remove ->virtual from struct page_address_map Lai Jiangshan
  2012-06-06  8:15 ` [PATCH 7/7] highmem: avoid page_address() in flush_all_zero_pkmaps() Lai Jiangshan
  5 siblings, 0 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:14 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan

Always allocate the struct page_address_map with the same index
(in page_address_maps) as kmap index.

it makes the allocation simpler.

pkmap_count[nr] == 0      <==>         page_address_maps[nr] is free
pkmap_count[nr] != 0      <==>         page_address_maps[nr] is in used

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 mm/highmem.c |   69 ++++++++++++++++++---------------------------------------
 1 files changed, 22 insertions(+), 47 deletions(-)

diff --git a/mm/highmem.c b/mm/highmem.c
index bf7f168..bd2b9d3 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -92,7 +92,8 @@ static DECLARE_WAIT_QUEUE_HEAD(pkmap_map_wait);
 		do { spin_unlock(&kmap_lock); (void)(flags); } while (0)
 #endif
 
-static void set_high_page_address(struct page *page, void *virtual);
+static void set_high_page_map(struct page *page, unsigned int nr);
+static void clear_high_page_map(unsigned int nr);
 
 static void flush_all_zero_pkmaps(void)
 {
@@ -128,7 +129,7 @@ static void flush_all_zero_pkmaps(void)
 		pte_clear(&init_mm, (unsigned long)page_address(page),
 			  &pkmap_page_table[i]);
 
-		set_high_page_address(page, NULL);
+		clear_high_page_map(i);
 		need_flush = 1;
 	}
 	if (need_flush)
@@ -190,7 +191,7 @@ start:
 		   &(pkmap_page_table[last_pkmap_nr]), mk_pte(page, kmap_prot));
 
 	pkmap_count[last_pkmap_nr] = 1;
-	set_high_page_address(page, (void *)vaddr);
+	set_high_page_map(page, last_pkmap_nr);
 
 	return vaddr;
 }
@@ -312,10 +313,7 @@ struct page_address_map {
 	struct list_head list;
 };
 
-/*
- * page_address_map freelist, allocated from page_address_maps.
- */
-static struct list_head page_address_pool;	/* freelist */
+static struct page_address_map page_address_maps[LAST_PKMAP];
 
 /*
  * Hash table bucket
@@ -365,58 +363,35 @@ done:
 
 EXPORT_SYMBOL(page_address);
 
-/**
- * set_high_page_address - set a page's virtual address
- * @page: &struct page to set
- * @virtual: virtual address to use
- */
-static void set_high_page_address(struct page *page, void *virtual)
+static void set_high_page_map(struct page *page, unsigned int nr)
 {
 	unsigned long flags;
-	struct page_address_slot *pas;
-	struct page_address_map *pam;
+	struct page_address_slot *pas = page_slot(page);
+	struct page_address_map *pam = &page_address_maps[nr];
 
-	BUG_ON(!PageHighMem(page));
+	pam->page = page;
+	pam->virtual = (void *)PKMAP_ADDR(nr);
 
-	pas = page_slot(page);
-	if (virtual) {		/* Add */
-		BUG_ON(list_empty(&page_address_pool));
-
-		pam = list_entry(page_address_pool.next,
-				struct page_address_map, list);
-		list_del(&pam->list);
+	spin_lock_irqsave(&pas->lock, flags);
+	list_add_tail(&pam->list, &pas->lh);
+	spin_unlock_irqrestore(&pas->lock, flags);
+}
 
-		pam->page = page;
-		pam->virtual = virtual;
+static void clear_high_page_map(unsigned int nr)
+{
+	unsigned long flags;
+	struct page_address_map *pam = &page_address_maps[nr];
+	struct page_address_slot *pas = page_slot(pam->page);
 
-		spin_lock_irqsave(&pas->lock, flags);
-		list_add_tail(&pam->list, &pas->lh);
-		spin_unlock_irqrestore(&pas->lock, flags);
-	} else {		/* Remove */
-		spin_lock_irqsave(&pas->lock, flags);
-		list_for_each_entry(pam, &pas->lh, list) {
-			if (pam->page == page) {
-				list_del(&pam->list);
-				spin_unlock_irqrestore(&pas->lock, flags);
-				list_add_tail(&pam->list, &page_address_pool);
-				goto done;
-			}
-		}
-		spin_unlock_irqrestore(&pas->lock, flags);
-	}
-done:
-	return;
+	spin_lock_irqsave(&pas->lock, flags);
+	list_del(&pam->list);
+	spin_unlock_irqrestore(&pas->lock, flags);
 }
 
-static struct page_address_map page_address_maps[LAST_PKMAP];
-
 void __init page_address_init(void)
 {
 	int i;
 
-	INIT_LIST_HEAD(&page_address_pool);
-	for (i = 0; i < ARRAY_SIZE(page_address_maps); i++)
-		list_add(&page_address_maps[i].list, &page_address_pool);
 	for (i = 0; i < ARRAY_SIZE(page_address_htable); i++) {
 		INIT_LIST_HEAD(&page_address_htable[i].lh);
 		spin_lock_init(&page_address_htable[i].lock);
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/7] highmem: remove ->virtual from struct page_address_map
  2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
                   ` (3 preceding siblings ...)
  2012-06-06  8:14 ` [PATCH 5/7] highmem: direct struct page_address_map allocation Lai Jiangshan
@ 2012-06-06  8:15 ` Lai Jiangshan
  2012-06-06  8:15 ` [PATCH 7/7] highmem: avoid page_address() in flush_all_zero_pkmaps() Lai Jiangshan
  5 siblings, 0 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:15 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan

The virtual address is (void *)PKMAP_ADDR(kmap_index),

But struct page_address_map is always allocated with the same index
(in page_address_maps) as kmap index.

So the virtual address is (void *)PKMAP_ADDR(pam - page_address_maps) here,
the ->virtual is not needed.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 mm/highmem.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/mm/highmem.c b/mm/highmem.c
index bd2b9d3..6f028cb 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -309,7 +309,6 @@ EXPORT_SYMBOL(kunmap_high);
  */
 struct page_address_map {
 	struct page *page;
-	void *virtual;
 	struct list_head list;
 };
 
@@ -339,6 +338,7 @@ void *page_address(const struct page *page)
 	unsigned long flags;
 	void *ret;
 	struct page_address_slot *pas;
+	struct page_address_map *pam;
 
 	if (!PageHighMem(page))
 		return lowmem_page_address(page);
@@ -346,18 +346,14 @@ void *page_address(const struct page *page)
 	pas = page_slot(page);
 	ret = NULL;
 	spin_lock_irqsave(&pas->lock, flags);
-	if (!list_empty(&pas->lh)) {
-		struct page_address_map *pam;
-
-		list_for_each_entry(pam, &pas->lh, list) {
-			if (pam->page == page) {
-				ret = pam->virtual;
-				goto done;
-			}
+	list_for_each_entry(pam, &pas->lh, list) {
+		if (pam->page == page) {
+			ret = (void *)PKMAP_ADDR(pam - page_address_maps);
+			break;
 		}
 	}
-done:
 	spin_unlock_irqrestore(&pas->lock, flags);
+
 	return ret;
 }
 
@@ -370,7 +366,6 @@ static void set_high_page_map(struct page *page, unsigned int nr)
 	struct page_address_map *pam = &page_address_maps[nr];
 
 	pam->page = page;
-	pam->virtual = (void *)PKMAP_ADDR(nr);
 
 	spin_lock_irqsave(&pas->lock, flags);
 	list_add_tail(&pam->list, &pas->lh);
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 7/7] highmem: avoid page_address() in flush_all_zero_pkmaps()
  2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
                   ` (4 preceding siblings ...)
  2012-06-06  8:15 ` [PATCH 6/7] highmem: remove ->virtual from struct page_address_map Lai Jiangshan
@ 2012-06-06  8:15 ` Lai Jiangshan
  5 siblings, 0 replies; 7+ messages in thread
From: Lai Jiangshan @ 2012-06-06  8:15 UTC (permalink / raw)
  Cc: Ingo Molnar, Peter Zijlstra, Tejun Heo, Al Viro, H. Peter Anvin,
	Ian Campbell, Paul Gortmaker, Mel Gorman, Michal Hocko, linux-mm,
	linux-kernel, Lai Jiangshan

We can get the virtual address from PKMAP_ADDR(i),
we don't need to call page_address() here.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 mm/highmem.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/mm/highmem.c b/mm/highmem.c
index 6f028cb..994fd68 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -103,8 +103,6 @@ static void flush_all_zero_pkmaps(void)
 	flush_cache_kmaps();
 
 	for (i = 0; i < LAST_PKMAP; i++) {
-		struct page *page;
-
 		/*
 		 * zero means we don't have anything to do,
 		 * >1 means that it is still in use. Only
@@ -125,9 +123,7 @@ static void flush_all_zero_pkmaps(void)
 		 * getting the kmap_lock (which is held here).
 		 * So no dangers, even with speculative execution.
 		 */
-		page = pte_page(pkmap_page_table[i]);
-		pte_clear(&init_mm, (unsigned long)page_address(page),
-			  &pkmap_page_table[i]);
+		pte_clear(&init_mm, PKMAP_ADDR(i), &pkmap_page_table[i]);
 
 		clear_high_page_map(i);
 		need_flush = 1;
-- 
1.7.7

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-06  8:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06  8:14 [PATCH 1/7] highmem: rearrange export symbol of __kmap_atomic_idx Lai Jiangshan
2012-06-06  8:14 ` [PATCH 2/7] highmem: rearrange the comments of pkmap_count Lai Jiangshan
2012-06-06  8:14 ` [PATCH 3/7] highmem: remove set_page_address() Lai Jiangshan
2012-06-06  8:14 ` [PATCH 4/7] highmem: remove pool_lock Lai Jiangshan
2012-06-06  8:14 ` [PATCH 5/7] highmem: direct struct page_address_map allocation Lai Jiangshan
2012-06-06  8:15 ` [PATCH 6/7] highmem: remove ->virtual from struct page_address_map Lai Jiangshan
2012-06-06  8:15 ` [PATCH 7/7] highmem: avoid page_address() in flush_all_zero_pkmaps() Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox