Skip to content

Commit 184748c

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
sched: Provide scheduler_ipi() callback in response to smp_send_reschedule()
For future rework of try_to_wake_up() we'd like to push part of that function onto the CPU the task is actually going to run on. In order to do so we need a generic callback from the existing scheduler IPI. This patch introduces such a generic callback: scheduler_ipi() and implements it as a NOP. BenH notes: PowerPC might use this IPI on offline CPUs under rare conditions! Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Acked-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Reviewed-by: Frank Rowand <frank.rowand@am.sony.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20110405152728.744338123@chello.nl
1 parent a4c98f8 commit 184748c

26 files changed

Lines changed: 63 additions & 50 deletions

File tree

‎arch/alpha/kernel/smp.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ handle_ipi(struct pt_regs *regs)
585585

586586
switch (which) {
587587
case IPI_RESCHEDULE:
588-
/* Reschedule callback. Everything to be done
589-
is done by the interrupt return path. */
588+
scheduler_ipi();
590589
break;
591590

592591
case IPI_CALL_FUNC:

‎arch/arm/kernel/smp.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,7 @@ asmlinkage void __exception_irq_entry do_IPI(int ipinr, struct pt_regs *regs)
560560
break;
561561

562562
case IPI_RESCHEDULE:
563-
/*
564-
* nothing more to do - eveything is
565-
* done on the interrupt return path
566-
*/
563+
scheduler_ipi();
567564
break;
568565

569566
case IPI_CALL_FUNC:

‎arch/blackfin/mach-common/smp.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)
164164
while (msg_queue->count) {
165165
msg = &msg_queue->ipi_message[msg_queue->head];
166166
switch (msg->type) {
167+
case BFIN_IPI_RESCHEDULE:
168+
scheduler_ipi();
169+
break;
167170
case BFIN_IPI_CALL_FUNC:
168171
spin_unlock_irqrestore(&msg_queue->lock, flags);
169172
ipi_call_function(cpu, msg);

‎arch/cris/arch-v32/kernel/smp.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,18 @@ irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id)
342342

343343
ipi = REG_RD(intr_vect, irq_regs[smp_processor_id()], rw_ipi);
344344

345+
if (ipi.vector & IPI_SCHEDULE) {
346+
scheduler_ipi();
347+
}
345348
if (ipi.vector & IPI_CALL) {
346-
func(info);
349+
func(info);
347350
}
348351
if (ipi.vector & IPI_FLUSH_TLB) {
349-
if (flush_mm == FLUSH_ALL)
350-
__flush_tlb_all();
351-
else if (flush_vma == FLUSH_ALL)
352+
if (flush_mm == FLUSH_ALL)
353+
__flush_tlb_all();
354+
else if (flush_vma == FLUSH_ALL)
352355
__flush_tlb_mm(flush_mm);
353-
else
356+
else
354357
__flush_tlb_page(flush_vma, flush_addr);
355358
}
356359

‎arch/ia64/kernel/irq_ia64.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/irq.h>
3232
#include <linux/ratelimit.h>
3333
#include <linux/acpi.h>
34+
#include <linux/sched.h>
3435

3536
#include <asm/delay.h>
3637
#include <asm/intrinsics.h>
@@ -496,6 +497,7 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
496497
smp_local_flush_tlb();
497498
kstat_incr_irqs_this_cpu(irq, desc);
498499
} else if (unlikely(IS_RESCHEDULE(vector))) {
500+
scheduler_ipi();
499501
kstat_incr_irqs_this_cpu(irq, desc);
500502
} else {
501503
ia64_setreg(_IA64_REG_CR_TPR, vector);

‎arch/ia64/xen/irq_xen.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,22 @@ static unsigned short saved_irq_cnt;
9292
static int xen_slab_ready;
9393

9494
#ifdef CONFIG_SMP
95+
#include <linux/sched.h>
96+
9597
/* Dummy stub. Though we may check XEN_RESCHEDULE_VECTOR before __do_IRQ,
9698
* it ends up to issue several memory accesses upon percpu data and
9799
* thus adds unnecessary traffic to other paths.
98100
*/
99101
static irqreturn_t
100102
xen_dummy_handler(int irq, void *dev_id)
101103
{
104+
return IRQ_HANDLED;
105+
}
102106

107+
static irqreturn_t
108+
xen_resched_handler(int irq, void *dev_id)
109+
{
110+
scheduler_ipi();
103111
return IRQ_HANDLED;
104112
}
105113

@@ -110,7 +118,7 @@ static struct irqaction xen_ipi_irqaction = {
110118
};
111119

112120
static struct irqaction xen_resched_irqaction = {
113-
.handler = xen_dummy_handler,
121+
.handler = xen_resched_handler,
114122
.flags = IRQF_DISABLED,
115123
.name = "resched"
116124
};

‎arch/m32r/kernel/smp.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ void smp_send_reschedule(int cpu_id)
122122
*
123123
* Description: This routine executes on CPU which received
124124
* 'RESCHEDULE_IPI'.
125-
* Rescheduling is processed at the exit of interrupt
126-
* operation.
127125
*
128126
* Born on Date: 2002.02.05
129127
*
@@ -138,7 +136,7 @@ void smp_send_reschedule(int cpu_id)
138136
*==========================================================================*/
139137
void smp_reschedule_interrupt(void)
140138
{
141-
/* nothing to do */
139+
scheduler_ipi();
142140
}
143141

144142
/*==========================================================================*

‎arch/mips/cavium-octeon/smp.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ static irqreturn_t mailbox_interrupt(int irq, void *dev_id)
4444

4545
if (action & SMP_CALL_FUNCTION)
4646
smp_call_function_interrupt();
47+
if (action & SMP_RESCHEDULE_YOURSELF)
48+
scheduler_ipi();
4749

4850
/* Check if we've been told to flush the icache */
4951
if (action & SMP_ICACHE_FLUSH)

‎arch/mips/kernel/smtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ static void post_direct_ipi(int cpu, struct smtc_ipi *pipi)
929929

930930
static void ipi_resched_interrupt(void)
931931
{
932-
/* Return from interrupt should be enough to cause scheduler check */
932+
scheduler_ipi();
933933
}
934934

935935
static void ipi_call_interrupt(void)

‎arch/mips/mti-malta/malta-int.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ static void ipi_call_dispatch(void)
309309

310310
static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
311311
{
312+
scheduler_ipi();
313+
312314
return IRQ_HANDLED;
313315
}
314316

0 commit comments

Comments
 (0)