Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f4ae5da0e8e92caa168e7c2a7c4a6c4064b082c2
Commit:     f4ae5da0e8e92caa168e7c2a7c4a6c4064b082c2
Parent:     72e458dfa63b3db7a46f66b0eb19e9ff4e17fc0e
Author:     Thomas Gleixner <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 16:48:07 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Feb 4 16:48:07 2008 +0100

    x86: cpa, check if we changed anything and tlb flushing is necessary
    
    Flush tlbs only when there was a real change.
    
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 arch/x86/mm/pageattr.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index d1c0830..79a9f1b 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -21,6 +21,7 @@ struct cpa_data {
        int             numpages;
        pgprot_t        mask_set;
        pgprot_t        mask_clr;
+       int             flushtlb;
 };
 
 static inline int
@@ -329,11 +330,19 @@ repeat:
                 * not the memory it points to
                 */
                new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot));
-               set_pte_atomic(kpte, new_pte);
+
+               /*
+                * Do we really change anything ?
+                */
+               if (pte_val(old_pte) != pte_val(new_pte)) {
+                       set_pte_atomic(kpte, new_pte);
+                       cpa->flushtlb = 1;
+               }
        } else {
                err = split_large_page(kpte, address);
                if (!err)
                        goto repeat;
+               cpa->flushtlb = 1;
        }
        return err;
 }
@@ -438,10 +447,17 @@ static int change_page_attr_set_clr(unsigned long addr, 
int numpages,
        cpa.numpages = numpages;
        cpa.mask_set = mask_set;
        cpa.mask_clr = mask_clr;
+       cpa.flushtlb = 0;
 
        ret = __change_page_attr_set_clr(&cpa);
 
        /*
+        * Check whether we really changed something:
+        */
+       if (!cpa.flushtlb)
+               return ret;
+
+       /*
         * No need to flush, when we did not set any of the caching
         * attributes:
         */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to