Skip to content

Commit 43858b4

Browse files
amlutoIngo Molnar
authored andcommitted
x86/mm: Stop calling leave_mm() in idle code
Now that lazy TLB suppresses all flush IPIs (as opposed to all but the first), there's no need to leave_mm() when going idle. This means we can get rid of the rcuidle hack in switch_mm_irqs_off() and we can unexport leave_mm(). This also removes acpi_unlazy_tlb() from the x86 and ia64 headers, since it has no callers any more. Signed-off-by: Andy Lutomirski <[email protected]> Reviewed-by: Nadav Amit <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rik van Riel <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/03c699cfd6021e467be650d6b73deaccfe4b4bd7.1498751203.git.luto@kernel.org Signed-off-by: Ingo Molnar <[email protected]>
1 parent 94b1b03 commit 43858b4

File tree

5 files changed

+7
-28
lines changed

5 files changed

+7
-28
lines changed

arch/ia64/include/asm/acpi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf)
112112
buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
113113
}
114114

115-
#define acpi_unlazy_tlb(x)
116-
117115
#ifdef CONFIG_ACPI_NUMA
118116
extern cpumask_t early_cpu_possible_map;
119117
#define for_each_possible_early_cpu(cpu) \

arch/x86/include/asm/acpi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ static inline void disable_acpi(void) { }
150150
extern int x86_acpi_numa_init(void);
151151
#endif /* CONFIG_ACPI_NUMA */
152152

153-
#define acpi_unlazy_tlb(x) leave_mm(x)
154-
155153
#ifdef CONFIG_ACPI_APEI
156154
static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
157155
{

arch/x86/mm/tlb.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ void leave_mm(int cpu)
5050

5151
switch_mm(NULL, &init_mm, NULL);
5252
}
53-
EXPORT_SYMBOL_GPL(leave_mm);
5453

5554
void switch_mm(struct mm_struct *prev, struct mm_struct *next,
5655
struct task_struct *tsk)
@@ -117,15 +116,8 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
117116
this_cpu_write(cpu_tlbstate.ctxs[0].tlb_gen,
118117
next_tlb_gen);
119118
write_cr3(__pa(next->pgd));
120-
121-
/*
122-
* This gets called via leave_mm() in the idle path
123-
* where RCU functions differently. Tracing normally
124-
* uses RCU, so we have to call the tracepoint
125-
* specially here.
126-
*/
127-
trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH,
128-
TLB_FLUSH_ALL);
119+
trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH,
120+
TLB_FLUSH_ALL);
129121
}
130122

131123
/*
@@ -167,13 +159,7 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next,
167159
this_cpu_write(cpu_tlbstate.loaded_mm, next);
168160
write_cr3(__pa(next->pgd));
169161

170-
/*
171-
* This gets called via leave_mm() in the idle path where RCU
172-
* functions differently. Tracing normally uses RCU, so we
173-
* have to call the tracepoint specially here.
174-
*/
175-
trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH,
176-
TLB_FLUSH_ALL);
162+
trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
177163
}
178164

179165
load_mm_cr4(next);

drivers/acpi/processor_idle.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,6 @@ static DEFINE_RAW_SPINLOCK(c3_lock);
708708
static void acpi_idle_enter_bm(struct acpi_processor *pr,
709709
struct acpi_processor_cx *cx, bool timer_bc)
710710
{
711-
acpi_unlazy_tlb(smp_processor_id());
712-
713711
/*
714712
* Must be done before busmaster disable as we might need to
715713
* access HPET !

drivers/idle/intel_idle.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -912,16 +912,15 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,
912912
struct cpuidle_state *state = &drv->states[index];
913913
unsigned long eax = flg2MWAIT(state->flags);
914914
unsigned int cstate;
915-
int cpu = smp_processor_id();
916915

917916
cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
918917

919918
/*
920-
* leave_mm() to avoid costly and often unnecessary wakeups
921-
* for flushing the user TLB's associated with the active mm.
919+
* NB: if CPUIDLE_FLAG_TLB_FLUSHED is set, this idle transition
920+
* will probably flush the TLB. It's not guaranteed to flush
921+
* the TLB, though, so it's not clear that we can do anything
922+
* useful with this knowledge.
922923
*/
923-
if (state->flags & CPUIDLE_FLAG_TLB_FLUSHED)
924-
leave_mm(cpu);
925924

926925
if (!(lapic_timer_reliable_states & (1 << (cstate))))
927926
tick_broadcast_enter();

0 commit comments

Comments
 (0)