From: Tejun Heo <tj@kernel.org>
To: JBeulich@novell.com, andi@firstfloor.org, mingo@elte.hu,
linux-kernel-owner@vger.kernel.org, hpa@zytor.com,
tglx@linutronix.de, linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/5] x86: reorganize cpa_process_alias()
Date: Fri, 15 May 2009 13:28:56 +0900 [thread overview]
Message-ID: <1242361739-21186-3-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1242361739-21186-1-git-send-email-tj@kernel.org>
Reorganize cpa_process_alias() so that new alias condition can be
added easily.
Jan Beulich spotted problem in the original cleanup thread which
incorrectly assumed the two existing conditions were mutially
exclusive.
[ Impact: code reorganization ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jan Beulich <JBeulich@novell.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
arch/x86/mm/pageattr.c | 44 ++++++++++++++++++++------------------------
1 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 797f9f1..8bc64b0 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -686,8 +686,8 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias);
static int cpa_process_alias(struct cpa_data *cpa)
{
struct cpa_data alias_cpa;
- int ret = 0;
unsigned long temp_cpa_vaddr, vaddr;
+ int ret;
if (cpa->pfn >= max_pfn_mapped)
return 0;
@@ -715,38 +715,34 @@ static int cpa_process_alias(struct cpa_data *cpa)
alias_cpa.vaddr = &temp_cpa_vaddr;
alias_cpa.flags &= ~(CPA_PAGES_ARRAY | CPA_ARRAY);
-
ret = __change_page_attr_set_clr(&alias_cpa, 0);
+ if (ret)
+ return ret;
}
#ifdef CONFIG_X86_64
- if (ret)
- return ret;
/*
- * No need to redo, when the primary call touched the high
- * mapping already:
- */
- if (within(vaddr, (unsigned long) _text, _brk_end))
- return 0;
-
- /*
- * If the physical address is inside the kernel map, we need
+ * If the primary call didn't touch the high mapping already
+ * and the physical address is inside the kernel map, we need
* to touch the high mapped kernel as well:
*/
- if (!within(cpa->pfn, highmap_start_pfn(), highmap_end_pfn()))
- return 0;
-
- alias_cpa = *cpa;
- temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) + __START_KERNEL_map - phys_base;
- alias_cpa.vaddr = &temp_cpa_vaddr;
- alias_cpa.flags &= ~(CPA_PAGES_ARRAY | CPA_ARRAY);
+ if (!within(vaddr, (unsigned long)_text, _brk_end) &&
+ within(cpa->pfn, highmap_start_pfn(), highmap_end_pfn())) {
+ alias_cpa = *cpa;
+ temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) +
+ __START_KERNEL_map - phys_base;
+ alias_cpa.vaddr = &temp_cpa_vaddr;
+ alias_cpa.flags &= ~(CPA_PAGES_ARRAY | CPA_ARRAY);
- /*
- * The high mapping range is imprecise, so ignore the return value.
- */
- __change_page_attr_set_clr(&alias_cpa, 0);
+ /*
+ * The high mapping range is imprecise, so ignore the
+ * return value.
+ */
+ __change_page_attr_set_clr(&alias_cpa, 0);
+ }
#endif
- return ret;
+
+ return 0;
}
static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
--
1.6.0.2
next prev parent reply other threads:[~2009-05-15 4:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-15 4:28 [GIT PATCH 2.6.30-rc5] x86,percpu: fix pageattr handling with remap allocator, take#2 Tejun Heo
2009-05-15 4:28 ` [PATCH 1/5] x86: prepare setup_pcpu_remap() for pageattr fix Tejun Heo
2009-05-15 4:28 ` Tejun Heo [this message]
2009-05-15 9:35 ` [PATCH UPDATED 2/5] x86: reorganize cpa_process_alias() Tejun Heo
2009-05-15 4:28 ` [PATCH 3/5] x86: fix pageattr handling for remap percpu allocator Tejun Heo
2009-05-15 7:58 ` Jan Beulich
2009-05-15 8:18 ` Tejun Heo
2009-05-15 9:35 ` [PATCH UPDATED " Tejun Heo
2009-05-15 4:28 ` [PATCH 4/5] x86: implement percpu_alloc kernel parameter Tejun Heo
2009-05-15 8:04 ` Jan Beulich
2009-05-15 9:27 ` Tejun Heo
2009-05-15 4:28 ` [PATCH 5/5] x86: ensure percpu remap doesn't consume too much vmalloc space Tejun Heo
2009-05-15 9:36 ` [GIT PATCH 2.6.30-rc5] x86,percpu: fix pageattr handling with remap allocator, take#2 Tejun Heo
2009-05-15 9:52 ` [GIT PATCH 2.6.30-rc5] x86,percpu: fix pageattr handling withremap " Jan Beulich
[not found] ` <4A0D57920200007800001150@novell.com>
2009-05-15 10:08 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2009-06-01 6:34 [GIT PATCH core/percpu] x86,percpu: fix pageattr handling with remap allocator, take#3 Tejun Heo
2009-06-01 6:34 ` [PATCH 2/5] x86: reorganize cpa_process_alias() Tejun Heo
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=1242361739-21186-3-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=JBeulich@novell.com \
--cc=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=linux-kernel-owner@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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