]> git.hungrycats.org Git - linux/commitdiff
init.c, pgalloc.h:
authorYanmin Zhang <yanmin.zhang@intel.com>
Mon, 9 Aug 2004 16:46:31 +0000 (16:46 +0000)
committerTony Luck <aegl@agluck-lia64.sc.intel.com>
Mon, 9 Aug 2004 16:46:31 +0000 (16:46 +0000)
  Disable pre-emption around access to pgtable_cache_size, pgd_quicklist,
  and pmd_quicklist.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: Zou Nanhai <nanhai.zou@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/mm/init.c
include/asm-ia64/pgalloc.h

index a85063a1260b4eefc1e9131235b57c329a3d457d..3ab0b37e0fa9d8ff6b7e9e44852c350d558f71cf 100644 (file)
@@ -63,6 +63,7 @@ check_pgt_cache (void)
        low = pgt_cache_water[0];
        high = pgt_cache_water[1];
 
+       preempt_disable();
        if (pgtable_cache_size > (u64) high) {
                do {
                        if (pgd_quicklist)
@@ -71,6 +72,7 @@ check_pgt_cache (void)
                                free_page((unsigned long)pmd_alloc_one_fast(0, 0));
                } while (pgtable_cache_size > (u64) low);
        }
+       preempt_enable();
 }
 
 void
index 68be9d57c7d0764748981a4dad9879a9f9e213d6..973316828f028fe1cfa009129a639e5ccca94fa4 100644 (file)
 static inline pgd_t*
 pgd_alloc_one_fast (struct mm_struct *mm)
 {
-       unsigned long *ret = pgd_quicklist;
+       unsigned long *ret = NULL;
 
+       preempt_disable();
+
+       ret = pgd_quicklist;
        if (likely(ret != NULL)) {
                pgd_quicklist = (unsigned long *)(*ret);
                ret[0] = 0;
                --pgtable_cache_size;
        } else
                ret = NULL;
+
+       preempt_enable();
+
        return (pgd_t *) ret;
 }
 
@@ -65,9 +71,11 @@ pgd_alloc (struct mm_struct *mm)
 static inline void
 pgd_free (pgd_t *pgd)
 {
+       preempt_disable();
        *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
        pgd_quicklist = (unsigned long *) pgd;
        ++pgtable_cache_size;
+       preempt_enable();
 }
 
 static inline void
@@ -80,13 +88,19 @@ pgd_populate (struct mm_struct *mm, pgd_t *pgd_entry, pmd_t *pmd)
 static inline pmd_t*
 pmd_alloc_one_fast (struct mm_struct *mm, unsigned long addr)
 {
-       unsigned long *ret = (unsigned long *)pmd_quicklist;
+       unsigned long *ret = NULL;
 
+       preempt_disable();
+
+       ret = (unsigned long *)pmd_quicklist;
        if (likely(ret != NULL)) {
                pmd_quicklist = (unsigned long *)(*ret);
                ret[0] = 0;
                --pgtable_cache_size;
        }
+
+       preempt_enable();
+
        return (pmd_t *)ret;
 }
 
@@ -103,9 +117,11 @@ pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
 static inline void
 pmd_free (pmd_t *pmd)
 {
+       preempt_disable();
        *(unsigned long *)pmd = (unsigned long) pmd_quicklist;
        pmd_quicklist = (unsigned long *) pmd;
        ++pgtable_cache_size;
+       preempt_enable();
 }
 
 #define __pmd_free_tlb(tlb, pmd)       pmd_free(pmd)