diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-09-29 08:25:16 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-11-05 01:53:53 -0500 |
commit | 3c5d92a0cfb5103c0d5ab74d4ae6373d3af38148 (patch) | |
tree | c8b50351568601428b6f9396ebfdd65e486b3097 | |
parent | eed3b9cf3fe3fcc7a50238dfcab63a63914e8f42 (diff) |
nohz: Introduce arch_needs_cpu
Allow the architecture to request a normal jiffy tick when the system
goes idle and tick_nohz_stop_sched_tick is called . On s390 the hook is
used to prevent the system going fully idle if there has been an
interrupt other than a clock comparator interrupt since the last wakeup.
On s390 the HiperSockets response time for 1 connection ping-pong goes
down from 42 to 34 microseconds. The CPU cost decreases by 27%.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
LKML-Reference: <20090929122533.402715150@de.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/s390/include/asm/cputime.h | 8 | ||||
-rw-r--r-- | arch/s390/kernel/s390_ext.c | 2 | ||||
-rw-r--r-- | arch/s390/kernel/vtime.c | 2 | ||||
-rw-r--r-- | drivers/s390/cio/cio.c | 1 | ||||
-rw-r--r-- | include/linux/tick.h | 3 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 13 |
6 files changed, 24 insertions, 5 deletions
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h index 24b1244aadb9..95f3561517c7 100644 --- a/arch/s390/include/asm/cputime.h +++ b/arch/s390/include/asm/cputime.h | |||
@@ -183,6 +183,7 @@ struct s390_idle_data { | |||
183 | unsigned long long idle_count; | 183 | unsigned long long idle_count; |
184 | unsigned long long idle_enter; | 184 | unsigned long long idle_enter; |
185 | unsigned long long idle_time; | 185 | unsigned long long idle_time; |
186 | int nohz_delay; | ||
186 | }; | 187 | }; |
187 | 188 | ||
188 | DECLARE_PER_CPU(struct s390_idle_data, s390_idle); | 189 | DECLARE_PER_CPU(struct s390_idle_data, s390_idle); |
@@ -198,4 +199,11 @@ static inline void s390_idle_check(void) | |||
198 | vtime_start_cpu(); | 199 | vtime_start_cpu(); |
199 | } | 200 | } |
200 | 201 | ||
202 | static inline int s390_nohz_delay(int cpu) | ||
203 | { | ||
204 | return per_cpu(s390_idle, cpu).nohz_delay != 0; | ||
205 | } | ||
206 | |||
207 | #define arch_needs_cpu(cpu) s390_nohz_delay(cpu) | ||
208 | |||
201 | #endif /* _S390_CPUTIME_H */ | 209 | #endif /* _S390_CPUTIME_H */ |
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c index 0de305b598ce..59618bcd99b7 100644 --- a/arch/s390/kernel/s390_ext.c +++ b/arch/s390/kernel/s390_ext.c | |||
@@ -126,6 +126,8 @@ void __irq_entry do_extint(struct pt_regs *regs, unsigned short code) | |||
126 | /* Serve timer interrupts first. */ | 126 | /* Serve timer interrupts first. */ |
127 | clock_comparator_work(); | 127 | clock_comparator_work(); |
128 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; | 128 | kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; |
129 | if (code != 0x1004) | ||
130 | __get_cpu_var(s390_idle).nohz_delay = 1; | ||
129 | index = ext_hash(code); | 131 | index = ext_hash(code); |
130 | for (p = ext_int_hash[index]; p; p = p->next) { | 132 | for (p = ext_int_hash[index]; p; p = p->next) { |
131 | if (likely(p->code == code)) | 133 | if (likely(p->code == code)) |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index c41bb0d416e1..b59a812a010e 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -167,6 +167,8 @@ void vtime_stop_cpu(void) | |||
167 | /* Wait for external, I/O or machine check interrupt. */ | 167 | /* Wait for external, I/O or machine check interrupt. */ |
168 | psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT; | 168 | psw.mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_IO | PSW_MASK_EXT; |
169 | 169 | ||
170 | idle->nohz_delay = 0; | ||
171 | |||
170 | /* Check if the CPU timer needs to be reprogrammed. */ | 172 | /* Check if the CPU timer needs to be reprogrammed. */ |
171 | if (vq->do_spt) { | 173 | if (vq->do_spt) { |
172 | __u64 vmax = VTIMER_MAX_SLICE; | 174 | __u64 vmax = VTIMER_MAX_SLICE; |
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 138124fcfcad..126f240715a4 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -618,6 +618,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs) | |||
618 | old_regs = set_irq_regs(regs); | 618 | old_regs = set_irq_regs(regs); |
619 | s390_idle_check(); | 619 | s390_idle_check(); |
620 | irq_enter(); | 620 | irq_enter(); |
621 | __get_cpu_var(s390_idle).nohz_delay = 1; | ||
621 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) | 622 | if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) |
622 | /* Serve timer interrupts first. */ | 623 | /* Serve timer interrupts first. */ |
623 | clock_comparator_work(); | 624 | clock_comparator_work(); |
diff --git a/include/linux/tick.h b/include/linux/tick.h index 0482229c07db..8dc082194b22 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -98,6 +98,9 @@ extern int tick_check_oneshot_change(int allow_nohz); | |||
98 | extern struct tick_sched *tick_get_tick_sched(int cpu); | 98 | extern struct tick_sched *tick_get_tick_sched(int cpu); |
99 | extern void tick_check_idle(int cpu); | 99 | extern void tick_check_idle(int cpu); |
100 | extern int tick_oneshot_mode_active(void); | 100 | extern int tick_oneshot_mode_active(void); |
101 | # ifndef arch_needs_cpu | ||
102 | # define arch_needs_cpu(cpu) (0) | ||
103 | # endif | ||
101 | # else | 104 | # else |
102 | static inline void tick_clock_notify(void) { } | 105 | static inline void tick_clock_notify(void) { } |
103 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } | 106 | static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 7378e2c71ca6..3840f6dff7eb 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -264,12 +264,15 @@ void tick_nohz_stop_sched_tick(int inidle) | |||
264 | last_jiffies = jiffies; | 264 | last_jiffies = jiffies; |
265 | } while (read_seqretry(&xtime_lock, seq)); | 265 | } while (read_seqretry(&xtime_lock, seq)); |
266 | 266 | ||
267 | /* Get the next timer wheel timer */ | 267 | if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) || |
268 | next_jiffies = get_next_timer_interrupt(last_jiffies); | 268 | arch_needs_cpu(cpu)) { |
269 | delta_jiffies = next_jiffies - last_jiffies; | 269 | next_jiffies = last_jiffies + 1; |
270 | |||
271 | if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu)) | ||
272 | delta_jiffies = 1; | 270 | delta_jiffies = 1; |
271 | } else { | ||
272 | /* Get the next timer wheel timer */ | ||
273 | next_jiffies = get_next_timer_interrupt(last_jiffies); | ||
274 | delta_jiffies = next_jiffies - last_jiffies; | ||
275 | } | ||
273 | /* | 276 | /* |
274 | * Do not stop the tick, if we are only one off | 277 | * Do not stop the tick, if we are only one off |
275 | * or if the cpu is required for rcu | 278 | * or if the cpu is required for rcu |