From: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Tejun Heo <tj@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
"H. Peter Anvin" <hpa@linux.intel.com>,
Ian Campbell <ian.campbell@citrix.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [PATCH 6/7] highmem: remove ->virtual from struct page_address_map
Date: Wed, 6 Jun 2012 16:15:00 +0800 [thread overview]
Message-ID: <1338970501-5098-6-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1338970501-5098-1-git-send-email-laijs@cn.fujitsu.com>
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>
next prev parent reply other threads:[~2012-06-06 8:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Lai Jiangshan [this message]
2012-06-06 8:15 ` [PATCH 7/7] highmem: avoid page_address() in flush_all_zero_pkmaps() Lai Jiangshan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1338970501-5098-6-git-send-email-laijs@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=a.p.zijlstra@chello.nl \
--cc=hpa@linux.intel.com \
--cc=ian.campbell@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=mingo@elte.hu \
--cc=paul.gortmaker@windriver.com \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox