]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bug fix: Do not calculate direct mapping pages when freeing vmemmap pagetables.
authorTang Chen <tangchen@cn.fujitsu.com>
Wed, 20 Feb 2013 02:14:15 +0000 (13:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:52:30 +0000 (16:52 +1100)
We only need to update direct_pages_count[level] when we freeing direct mapped
pagetables.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/x86/mm/init_64.c

index 80063cd4b1df2208b82ffe804a645f42d9e9d87c..56bedb1a8224e384faece4de9e7fa93cde817450 100644 (file)
@@ -829,14 +829,13 @@ remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
 
                if (IS_ALIGNED(addr, PAGE_SIZE) &&
                    IS_ALIGNED(next, PAGE_SIZE)) {
-                       if (!direct) {
+                       if (!direct)
                                free_pagetable(pte_page(*pte), 0);
-                               pages++;
-                       }
 
                        spin_lock(&init_mm.page_table_lock);
                        pte_clear(&init_mm, addr, pte);
                        spin_unlock(&init_mm.page_table_lock);
+                       pages++;
                } else {
                        /*
                         * If we are not removing the whole page, it means
@@ -849,11 +848,11 @@ remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
 
                        if (!memchr_inv(page_addr, PAGE_INUSE, PAGE_SIZE)) {
                                free_pagetable(pte_page(*pte), 0);
-                               pages++;
 
                                spin_lock(&init_mm.page_table_lock);
                                pte_clear(&init_mm, addr, pte);
                                spin_unlock(&init_mm.page_table_lock);
+                               pages++;
                        }
                }
        }
@@ -882,15 +881,14 @@ remove_pmd_table(pmd_t *pmd_start, unsigned long addr, unsigned long end,
                if (pmd_large(*pmd)) {
                        if (IS_ALIGNED(addr, PMD_SIZE) &&
                            IS_ALIGNED(next, PMD_SIZE)) {
-                               if (!direct) {
+                               if (!direct)
                                        free_pagetable(pmd_page(*pmd),
                                                       get_order(PMD_SIZE));
-                                       pages++;
-                               }
 
                                spin_lock(&init_mm.page_table_lock);
                                pmd_clear(pmd);
                                spin_unlock(&init_mm.page_table_lock);
+                               pages++;
                                continue;
                        }
 
@@ -939,15 +937,14 @@ remove_pud_table(pud_t *pud_start, unsigned long addr, unsigned long end,
                if (pud_large(*pud)) {
                        if (IS_ALIGNED(addr, PUD_SIZE) &&
                            IS_ALIGNED(next, PUD_SIZE)) {
-                               if (!direct) {
+                               if (!direct)
                                        free_pagetable(pud_page(*pud),
                                                       get_order(PUD_SIZE));
-                                       pages++;
-                               }
 
                                spin_lock(&init_mm.page_table_lock);
                                pud_clear(pud);
                                spin_unlock(&init_mm.page_table_lock);
+                               pages++;
                                continue;
                        }