diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-02-18 02:46:21 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-03-30 02:36:00 -0400 |
commit | b407fc57b815b2016186220baabc76cc8264206e (patch) | |
tree | 29949f727af8b6c19fd689fa10f123ea84c03cb0 /arch/x86/kernel/paravirt.c | |
parent | 7fd7d83d49914f03aefffba6aee09032fcd54cce (diff) |
x86/paravirt: flush pending mmu updates on context switch
Impact: allow preemption during lazy mmu updates
If we're in lazy mmu mode when context switching, leave
lazy mmu mode, but remember the task's state in
TIF_LAZY_MMU_UPDATES. When we resume the task, check this
flag and re-enter lazy mmu mode if its set.
This sets things up for allowing lazy mmu mode while preemptible,
though that won't actually be active until the next change.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Diffstat (limited to 'arch/x86/kernel/paravirt.c')
-rw-r--r-- | arch/x86/kernel/paravirt.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 5eea9548216..430a0e30577 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -252,7 +252,7 @@ static inline void enter_lazy(enum paravirt_lazy_mode mode) | |||
252 | __get_cpu_var(paravirt_lazy_mode) = mode; | 252 | __get_cpu_var(paravirt_lazy_mode) = mode; |
253 | } | 253 | } |
254 | 254 | ||
255 | void paravirt_leave_lazy(enum paravirt_lazy_mode mode) | 255 | static void leave_lazy(enum paravirt_lazy_mode mode) |
256 | { | 256 | { |
257 | BUG_ON(__get_cpu_var(paravirt_lazy_mode) != mode); | 257 | BUG_ON(__get_cpu_var(paravirt_lazy_mode) != mode); |
258 | BUG_ON(preemptible()); | 258 | BUG_ON(preemptible()); |
@@ -267,17 +267,24 @@ void paravirt_enter_lazy_mmu(void) | |||
267 | 267 | ||
268 | void paravirt_leave_lazy_mmu(void) | 268 | void paravirt_leave_lazy_mmu(void) |
269 | { | 269 | { |
270 | paravirt_leave_lazy(PARAVIRT_LAZY_MMU); | 270 | leave_lazy(PARAVIRT_LAZY_MMU); |
271 | } | 271 | } |
272 | 272 | ||
273 | void paravirt_enter_lazy_cpu(void) | 273 | void paravirt_enter_lazy_cpu(void) |
274 | { | 274 | { |
275 | if (percpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) { | ||
276 | arch_leave_lazy_mmu_mode(); | ||
277 | set_thread_flag(TIF_LAZY_MMU_UPDATES); | ||
278 | } | ||
275 | enter_lazy(PARAVIRT_LAZY_CPU); | 279 | enter_lazy(PARAVIRT_LAZY_CPU); |
276 | } | 280 | } |
277 | 281 | ||
278 | void paravirt_leave_lazy_cpu(void) | 282 | void paravirt_leave_lazy_cpu(void) |
279 | { | 283 | { |
280 | paravirt_leave_lazy(PARAVIRT_LAZY_CPU); | 284 | leave_lazy(PARAVIRT_LAZY_CPU); |
285 | |||
286 | if (test_and_clear_thread_flag(TIF_LAZY_MMU_UPDATES)) | ||
287 | arch_enter_lazy_mmu_mode(); | ||
281 | } | 288 | } |
282 | 289 | ||
283 | enum paravirt_lazy_mode paravirt_get_lazy_mode(void) | 290 | enum paravirt_lazy_mode paravirt_get_lazy_mode(void) |