[PATCH] mm: disable preemption in apply_to_pte_range

From: Jeremy Fitzhardinge
Date: Thu Feb 12 2009 - 19:21:21 EST


commit 79d9c90453a7bc9e7613ae889a97ff6b44ab8380
Author: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
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@xxxxxxxxxx>

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;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/