Messages in this thread Patch in this message | | | Date | Thu, 12 Feb 2009 16:21:04 -0800 | From | Jeremy Fitzhardinge <> | Subject | [PATCH] mm: disable preemption in apply_to_pte_range |
| |
commit 79d9c90453a7bc9e7613ae889a97ff6b44ab8380 Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Date: Thu Feb 12 13:45:34 2009 -0800
mm: disable preemption in apply_to_pte_range
Lazy mmu mode needs preemption disabled, so if we're apply to init_mm (which doesn't require any pte locks), then explicitly disable preemption.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
diff --git a/mm/memory.c b/mm/memory.c index baa999e..71b3fb8 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1710,9 +1710,11 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, pgtable_t token; spinlock_t *uninitialized_var(ptl); - pte = (mm == &init_mm) ? - pte_alloc_kernel(pmd, addr) : - pte_alloc_map_lock(mm, pmd, addr, &ptl); + if (mm == &init_mm) { + preempt_disable(); + pte = pte_alloc_kernel(pmd, addr); + } else + pte = pte_alloc_map_lock(mm, pmd, addr, &ptl); if (!pte) return -ENOMEM; @@ -1732,6 +1734,9 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, if (mm != &init_mm) pte_unmap_unlock(pte-1, ptl); + else + preempt_enable(); + return err; }
| |