* [PATCH] x86: make mm/gup.c more virtualization friendly
@ 2008-09-17 15:48 Jan Beulich
2008-09-18 10:15 ` Ingo Molnar
2008-09-23 4:42 ` Nick Piggin
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2008-09-17 15:48 UTC (permalink / raw)
To: mingo, tglx, hpa; +Cc: Nick Piggin, linux-kernel
Since pte_flags() is much cheaper than pte_val() in some virtualized
environments (namely, Xen), use the former whereever possible.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Nick Piggin <npiggin@suse.de>
---
arch/x86/mm/gup.c | 10 +++++-----
include/asm-x86/pgtable.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
--- linux-2.6.27-rc6/arch/x86/mm/gup.c 2008-08-21 14:37:29.000000000 +0200
+++ 2.6.27-rc6-x86-gup-virt/arch/x86/mm/gup.c 2008-09-02 13:33:42.000000000 +0200
@@ -82,7 +82,7 @@ static noinline int gup_pte_range(pmd_t
pte_t pte = gup_get_pte(ptep);
struct page *page;
- if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask) {
+ if ((pte_flags(pte) & (mask | _PAGE_SPECIAL)) != mask) {
pte_unmap(ptep);
return 0;
}
@@ -116,10 +116,10 @@ static noinline int gup_huge_pmd(pmd_t p
mask = _PAGE_PRESENT|_PAGE_USER;
if (write)
mask |= _PAGE_RW;
- if ((pte_val(pte) & mask) != mask)
+ if ((pte_flags(pte) & mask) != mask)
return 0;
/* hugepages are never "special" */
- VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
+ VM_BUG_ON(pte_flags(pte) & _PAGE_SPECIAL);
VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
refs = 0;
@@ -173,10 +173,10 @@ static noinline int gup_huge_pud(pud_t p
mask = _PAGE_PRESENT|_PAGE_USER;
if (write)
mask |= _PAGE_RW;
- if ((pte_val(pte) & mask) != mask)
+ if ((pte_flags(pte) & mask) != mask)
return 0;
/* hugepages are never "special" */
- VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
+ VM_BUG_ON(pte_flags(pte) & _PAGE_SPECIAL);
VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
refs = 0;
--- linux-2.6.27-rc6/include/asm-x86/pgtable.h 2008-08-21 14:37:34.000000000 +0200
+++ 2.6.27-rc6-x86-gup-virt/include/asm-x86/pgtable.h 2008-09-02 13:31:50.000000000 +0200
@@ -183,7 +183,7 @@ static inline int pte_exec(pte_t pte)
static inline int pte_special(pte_t pte)
{
- return pte_val(pte) & _PAGE_SPECIAL;
+ return pte_flags(pte) & _PAGE_SPECIAL;
}
static inline int pmd_large(pmd_t pte)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: make mm/gup.c more virtualization friendly
2008-09-17 15:48 [PATCH] x86: make mm/gup.c more virtualization friendly Jan Beulich
@ 2008-09-18 10:15 ` Ingo Molnar
2008-09-23 4:42 ` Nick Piggin
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-09-18 10:15 UTC (permalink / raw)
To: Jan Beulich; +Cc: tglx, hpa, Nick Piggin, linux-kernel, Jeremy Fitzhardinge
* Jan Beulich <jbeulich@novell.com> wrote:
> Since pte_flags() is much cheaper than pte_val() in some virtualized
> environments (namely, Xen), use the former whereever possible.
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: Nick Piggin <npiggin@suse.de>
applied to tip/x86/core, thanks Jan.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: make mm/gup.c more virtualization friendly
2008-09-17 15:48 [PATCH] x86: make mm/gup.c more virtualization friendly Jan Beulich
2008-09-18 10:15 ` Ingo Molnar
@ 2008-09-23 4:42 ` Nick Piggin
1 sibling, 0 replies; 3+ messages in thread
From: Nick Piggin @ 2008-09-23 4:42 UTC (permalink / raw)
To: Jan Beulich; +Cc: mingo, tglx, hpa, linux-kernel
No objections from me.
On Wed, Sep 17, 2008 at 04:48:17PM +0100, Jan Beulich wrote:
> Since pte_flags() is much cheaper than pte_val() in some virtualized
> environments (namely, Xen), use the former whereever possible.
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: Nick Piggin <npiggin@suse.de>
>
> ---
> arch/x86/mm/gup.c | 10 +++++-----
> include/asm-x86/pgtable.h | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> --- linux-2.6.27-rc6/arch/x86/mm/gup.c 2008-08-21 14:37:29.000000000 +0200
> +++ 2.6.27-rc6-x86-gup-virt/arch/x86/mm/gup.c 2008-09-02 13:33:42.000000000 +0200
> @@ -82,7 +82,7 @@ static noinline int gup_pte_range(pmd_t
> pte_t pte = gup_get_pte(ptep);
> struct page *page;
>
> - if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask) {
> + if ((pte_flags(pte) & (mask | _PAGE_SPECIAL)) != mask) {
> pte_unmap(ptep);
> return 0;
> }
> @@ -116,10 +116,10 @@ static noinline int gup_huge_pmd(pmd_t p
> mask = _PAGE_PRESENT|_PAGE_USER;
> if (write)
> mask |= _PAGE_RW;
> - if ((pte_val(pte) & mask) != mask)
> + if ((pte_flags(pte) & mask) != mask)
> return 0;
> /* hugepages are never "special" */
> - VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
> + VM_BUG_ON(pte_flags(pte) & _PAGE_SPECIAL);
> VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
>
> refs = 0;
> @@ -173,10 +173,10 @@ static noinline int gup_huge_pud(pud_t p
> mask = _PAGE_PRESENT|_PAGE_USER;
> if (write)
> mask |= _PAGE_RW;
> - if ((pte_val(pte) & mask) != mask)
> + if ((pte_flags(pte) & mask) != mask)
> return 0;
> /* hugepages are never "special" */
> - VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
> + VM_BUG_ON(pte_flags(pte) & _PAGE_SPECIAL);
> VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
>
> refs = 0;
> --- linux-2.6.27-rc6/include/asm-x86/pgtable.h 2008-08-21 14:37:34.000000000 +0200
> +++ 2.6.27-rc6-x86-gup-virt/include/asm-x86/pgtable.h 2008-09-02 13:31:50.000000000 +0200
> @@ -183,7 +183,7 @@ static inline int pte_exec(pte_t pte)
>
> static inline int pte_special(pte_t pte)
> {
> - return pte_val(pte) & _PAGE_SPECIAL;
> + return pte_flags(pte) & _PAGE_SPECIAL;
> }
>
> static inline int pmd_large(pmd_t pte)
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-23 4:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 15:48 [PATCH] x86: make mm/gup.c more virtualization friendly Jan Beulich
2008-09-18 10:15 ` Ingo Molnar
2008-09-23 4:42 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox