Skip to content

Commit b291457

Browse files
hdellergregkh
authored andcommitted
parisc/mm: Ensure IRQs are off in switch_mm()
commit 649aa24254e85bf6bd7807dd372d083707852b1f upstream. This is because of commit f98db6013c55 ("sched/core: Add switch_mm_irqs_off() and use it in the scheduler") in which switch_mm_irqs_off() is called by the scheduler, vs switch_mm() which is used by use_mm(). This patch lets the parisc code mirror the x86 and powerpc code, ie. it disables interrupts in switch_mm(), and optimises the scheduler case by defining switch_mm_irqs_off(). Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 635a582 commit b291457

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

arch/parisc/include/asm/mmu_context.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,26 @@ static inline void load_context(mm_context_t context)
4949
mtctl(__space_to_prot(context), 8);
5050
}
5151

52-
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
52+
static inline void switch_mm_irqs_off(struct mm_struct *prev,
53+
struct mm_struct *next, struct task_struct *tsk)
5354
{
54-
5555
if (prev != next) {
5656
mtctl(__pa(next->pgd), 25);
5757
load_context(next->context);
5858
}
5959
}
6060

61+
static inline void switch_mm(struct mm_struct *prev,
62+
struct mm_struct *next, struct task_struct *tsk)
63+
{
64+
unsigned long flags;
65+
66+
local_irq_save(flags);
67+
switch_mm_irqs_off(prev, next, tsk);
68+
local_irq_restore(flags);
69+
}
70+
#define switch_mm_irqs_off switch_mm_irqs_off
71+
6172
#define deactivate_mm(tsk,mm) do { } while (0)
6273

6374
static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)

0 commit comments

Comments
 (0)