Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1390044
| From | tip-bot for Andy Lutomirski <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:sched/core] sched/core: Add switch_mm_irqs_off() and use it in the scheduler |
| Date | 2016-04-28 12:50 +0200 |
| Message-ID | <rsRGc-1DA-57@gated-at.bofh.it> (permalink) |
| References | <rselr-2qW-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: f98db6013c557c216da5038d9c52045be55cd039
Gitweb: http://git.kernel.org/tip/f98db6013c557c216da5038d9c52045be55cd039
Author: Andy Lutomirski <luto@kernel.org>
AuthorDate: Tue, 26 Apr 2016 09:39:06 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 28 Apr 2016 11:44:19 +0200
sched/core: Add switch_mm_irqs_off() and use it in the scheduler
By default, this is the same thing as switch_mm().
x86 will override it as an optimization.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/df401df47bdd6be3e389c6f1e3f5310d70e81b2c.1461688545.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/mmu_context.h | 7 +++++++
kernel/sched/core.c | 6 +++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/linux/mmu_context.h b/include/linux/mmu_context.h
index 70fffeb..a444178 100644
--- a/include/linux/mmu_context.h
+++ b/include/linux/mmu_context.h
@@ -1,9 +1,16 @@
#ifndef _LINUX_MMU_CONTEXT_H
#define _LINUX_MMU_CONTEXT_H
+#include <asm/mmu_context.h>
+
struct mm_struct;
void use_mm(struct mm_struct *mm);
void unuse_mm(struct mm_struct *mm);
+/* Architectures that care about IRQ state in switch_mm can override this. */
+#ifndef switch_mm_irqs_off
+# define switch_mm_irqs_off switch_mm
+#endif
+
#endif
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9d84d60..adcafda 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -33,7 +33,7 @@
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/highmem.h>
-#include <asm/mmu_context.h>
+#include <linux/mmu_context.h>
#include <linux/interrupt.h>
#include <linux/capability.h>
#include <linux/completion.h>
@@ -2733,7 +2733,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
atomic_inc(&oldmm->mm_count);
enter_lazy_tlb(oldmm, next);
} else
- switch_mm(oldmm, mm, next);
+ switch_mm_irqs_off(oldmm, mm, next);
if (!prev->mm) {
prev->active_mm = NULL;
@@ -5274,7 +5274,7 @@ void idle_task_exit(void)
BUG_ON(cpu_online(smp_processor_id()));
if (mm != &init_mm) {
- switch_mm(mm, &init_mm, current);
+ switch_mm_irqs_off(mm, &init_mm, current);
finish_arch_post_lock_switch();
}
mmdrop(mm);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/5] x86 switch_mm uninlining and IRQ improvements Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:40 +0200
[PATCH v2 3/5] x86/mm: Build arch/x86/mm/tlb.c even on !SMP Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:40 +0200
[tip:sched/core] x86/mm: Build arch/x86/mm/tlb.c even on !SMP tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-28 12:50 +0200
[PATCH v2 4/5] x86/mm: Uninline switch_mm Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:40 +0200
[tip:sched/core] x86/mm, sched/core: Uninline switch_mm() tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-28 12:50 +0200
[PATCH v2 5/5] x86/mm: Turn off IRQs in switch_mm Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:40 +0200
[tip:sched/core] x86/mm, sched/core: Turn off IRQs in switch_mm() tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-28 12:50 +0200
[PATCH v2 1/5] arm: Include linux/preempt.h from asm/mmu_context.h Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:40 +0200
[tip:sched/core] sched/core, ARM: Include linux/preempt.h from asm/mmu_context.h tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-28 12:40 +0200
Re: [tip:sched/core] sched/core, ARM: Include linux/preempt.h from asm/mmu_context.h Russell King - ARM Linux <linux@arm.linux.org.uk> - 2016-04-28 12:50 +0200
Re: [PATCH v2 1/5] arm: Include linux/preempt.h from asm/mmu_context.h Russell King - ARM Linux <linux@arm.linux.org.uk> - 2016-04-28 15:30 +0200
[PATCH v2 2/5] sched: Add switch_mm_irqs_off and use it in the scheduler Andy Lutomirski <luto@kernel.org> - 2016-04-26 18:50 +0200
[tip:sched/core] sched/core: Add switch_mm_irqs_off() and use it in the scheduler tip-bot for Andy Lutomirski <tipbot@zytor.com> - 2016-04-28 12:50 +0200
Re: [PATCH v2 0/5] x86 switch_mm uninlining and IRQ improvements Borislav Petkov <bp@alien8.de> - 2016-04-27 20:10 +0200
csiph-web