Skip to content

Commit fe0f497

Browse files
author
Martin Schwidefsky
committed
s390/nohz: use a per-cpu flag for arch_needs_cpu
Move the nohz_delay bit from the s390_idle data structure to the per-cpu flags. Clear the nohz delay flag in __cpu_disable and remove the cpu hotplug notifier that used to do this. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent a9b1649 commit fe0f497

File tree

9 files changed

+11
-31
lines changed

9 files changed

+11
-31
lines changed

arch/s390/include/asm/cputime.h

-8
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ static inline clock_t cputime64_to_clock_t(cputime64_t cputime)
166166
}
167167

168168
struct s390_idle_data {
169-
int nohz_delay;
170169
unsigned int sequence;
171170
unsigned long long idle_count;
172171
unsigned long long idle_time;
@@ -182,11 +181,4 @@ cputime64_t s390_get_idle_time(int cpu);
182181

183182
#define arch_idle_time(cpu) s390_get_idle_time(cpu)
184183

185-
static inline int s390_nohz_delay(int cpu)
186-
{
187-
return __get_cpu_var(s390_idle).nohz_delay != 0;
188-
}
189-
190-
#define arch_needs_cpu(cpu) s390_nohz_delay(cpu)
191-
192184
#endif /* _S390_CPUTIME_H */

arch/s390/include/asm/processor.h

+4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
#define CIF_MCCK_PENDING 0 /* machine check handling is pending */
1515
#define CIF_ASCE 1 /* user asce needs fixup / uaccess */
16+
#define CIF_NOHZ_DELAY 2 /* delay HZ disable for a tick */
1617

1718
#define _CIF_MCCK_PENDING (1<<CIF_MCCK_PENDING)
1819
#define _CIF_ASCE (1<<CIF_ASCE)
20+
#define _CIF_NOHZ_DELAY (1<<CIF_NOHZ_DELAY)
1921

2022

2123
#ifndef __ASSEMBLY__
@@ -43,6 +45,8 @@ static inline int test_cpu_flag(int flag)
4345
return !!(S390_lowcore.cpu_flags & (1U << flag));
4446
}
4547

48+
#define arch_needs_cpu() test_cpu_flag(CIF_NOHZ_DELAY)
49+
4650
/*
4751
* Default implementation of macro that returns current
4852
* instruction pointer ("program counter").

arch/s390/kernel/irq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static irqreturn_t do_ext_interrupt(int irq, void *dummy)
259259

260260
ext_code = *(struct ext_code *) &regs->int_code;
261261
if (ext_code.code != EXT_IRQ_CLK_COMP)
262-
__get_cpu_var(s390_idle).nohz_delay = 1;
262+
set_cpu_flag(CIF_NOHZ_DELAY);
263263

264264
index = ext_hash(ext_code.code);
265265
rcu_read_lock();

arch/s390/kernel/smp.c

+1
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,7 @@ int __cpu_disable(void)
720720
cregs[6] &= ~0xff000000UL; /* disable all I/O interrupts */
721721
cregs[14] &= ~0x1f000000UL; /* disable most machine checks */
722722
__ctl_load(cregs, 0, 15);
723+
clear_cpu_flag(CIF_NOHZ_DELAY);
723724
return 0;
724725
}
725726

arch/s390/kernel/vtime.c

+1-18
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ void __kprobes vtime_stop_cpu(void)
163163
/* Wait for external, I/O or machine check interrupt. */
164164
psw_mask = PSW_KERNEL_BITS | PSW_MASK_WAIT | PSW_MASK_DAT |
165165
PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
166-
idle->nohz_delay = 0;
166+
clear_cpu_flag(CIF_NOHZ_DELAY);
167167

168168
/* Call the assembler magic in entry.S */
169169
psw_idle(idle, psw_mask);
@@ -378,25 +378,8 @@ void init_cpu_vtimer(void)
378378
set_vtimer(VTIMER_MAX_SLICE);
379379
}
380380

381-
static int s390_nohz_notify(struct notifier_block *self, unsigned long action,
382-
void *hcpu)
383-
{
384-
struct s390_idle_data *idle;
385-
long cpu = (long) hcpu;
386-
387-
idle = &per_cpu(s390_idle, cpu);
388-
switch (action & ~CPU_TASKS_FROZEN) {
389-
case CPU_DYING:
390-
idle->nohz_delay = 0;
391-
default:
392-
break;
393-
}
394-
return NOTIFY_OK;
395-
}
396-
397381
void __init vtime_init(void)
398382
{
399383
/* Enable cpu timer interrupts on the boot cpu. */
400384
init_cpu_vtimer();
401-
cpu_notifier(s390_nohz_notify, 0);
402385
}

drivers/s390/cio/airq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static irqreturn_t do_airq_interrupt(int irq, void *dummy)
8787
struct airq_struct *airq;
8888
struct hlist_head *head;
8989

90-
__this_cpu_write(s390_idle.nohz_delay, 1);
90+
set_cpu_flag(CIF_NOHZ_DELAY);
9191
tpi_info = (struct tpi_info *) &get_irq_regs()->int_code;
9292
head = &airq_lists[tpi_info->isc];
9393
rcu_read_lock();

drivers/s390/cio/cio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ static irqreturn_t do_cio_interrupt(int irq, void *dummy)
561561
struct subchannel *sch;
562562
struct irb *irb;
563563

564-
__this_cpu_write(s390_idle.nohz_delay, 1);
564+
set_cpu_flag(CIF_NOHZ_DELAY);
565565
tpi_info = (struct tpi_info *) &get_irq_regs()->int_code;
566566
irb = &__get_cpu_var(cio_irb);
567567
sch = (struct subchannel *)(unsigned long) tpi_info->intparm;

include/linux/tick.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ extern struct tick_sched *tick_get_tick_sched(int cpu);
108108
extern void tick_irq_enter(void);
109109
extern int tick_oneshot_mode_active(void);
110110
# ifndef arch_needs_cpu
111-
# define arch_needs_cpu(cpu) (0)
111+
# define arch_needs_cpu() (0)
112112
# endif
113113
# else
114114
static inline void tick_clock_notify(void) { }

kernel/time/tick-sched.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
572572
} while (read_seqretry(&jiffies_lock, seq));
573573

574574
if (rcu_needs_cpu(cpu, &rcu_delta_jiffies) ||
575-
arch_needs_cpu(cpu) || irq_work_needs_cpu()) {
575+
arch_needs_cpu() || irq_work_needs_cpu()) {
576576
next_jiffies = last_jiffies + 1;
577577
delta_jiffies = 1;
578578
} else {

0 commit comments

Comments
 (0)