Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d80512f8 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky
Browse files

s390/smp: improve setup of possible cpu mask



Since under z/VM we cannot have more than 64 cpus, make sure the
cpu_possible_mask does not contain more bits.
This avoids wasting memory for dynamic per-cpu allocations if
CONFIG_NR_CPUS is larger than 64.

Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 319e2e3f
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -135,7 +135,6 @@ config S390
	select HAVE_SYSCALL_TRACEPOINTS
	select HAVE_SYSCALL_TRACEPOINTS
	select HAVE_UID16 if 32BIT
	select HAVE_UID16 if 32BIT
	select HAVE_VIRT_CPU_ACCOUNTING
	select HAVE_VIRT_CPU_ACCOUNTING
	select INIT_ALL_POSSIBLE
	select KTIME_SCALAR if 32BIT
	select KTIME_SCALAR if 32BIT
	select MODULES_USE_ELF_RELA
	select MODULES_USE_ELF_RELA
	select OLD_SIGACTION
	select OLD_SIGACTION
+2 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ extern void smp_yield(void);
extern void smp_stop_cpu(void);
extern void smp_stop_cpu(void);
extern void smp_cpu_set_polarization(int cpu, int val);
extern void smp_cpu_set_polarization(int cpu, int val);
extern int smp_cpu_get_polarization(int cpu);
extern int smp_cpu_get_polarization(int cpu);
extern void smp_fill_possible_mask(void);


#else /* CONFIG_SMP */
#else /* CONFIG_SMP */


@@ -50,6 +51,7 @@ static inline int smp_vcpu_scheduled(int cpu) { return 1; }
static inline void smp_yield_cpu(int cpu) { }
static inline void smp_yield_cpu(int cpu) { }
static inline void smp_yield(void) { }
static inline void smp_yield(void) { }
static inline void smp_stop_cpu(void) { }
static inline void smp_stop_cpu(void) { }
static inline void smp_fill_possible_mask(void) { }


#endif /* CONFIG_SMP */
#endif /* CONFIG_SMP */


+1 −0
Original line number Original line Diff line number Diff line
@@ -1023,6 +1023,7 @@ void __init setup_arch(char **cmdline_p)
	setup_vmcoreinfo();
	setup_vmcoreinfo();
	setup_lowcore();
	setup_lowcore();


	smp_fill_possible_mask();
        cpu_init();
        cpu_init();
	s390_init_cpu_topology();
	s390_init_cpu_topology();


+16 −9
Original line number Original line Diff line number Diff line
@@ -721,18 +721,14 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
	return 0;
	return 0;
}
}


static int __init setup_possible_cpus(char *s)
static unsigned int setup_possible_cpus __initdata;
{
	int max, cpu;


	if (kstrtoint(s, 0, &max) < 0)
static int __init _setup_possible_cpus(char *s)
		return 0;
{
	init_cpu_possible(cpumask_of(0));
	get_option(&s, &setup_possible_cpus);
	for (cpu = 1; cpu < max && cpu < nr_cpu_ids; cpu++)
		set_cpu_possible(cpu, true);
	return 0;
	return 0;
}
}
early_param("possible_cpus", setup_possible_cpus);
early_param("possible_cpus", _setup_possible_cpus);


#ifdef CONFIG_HOTPLUG_CPU
#ifdef CONFIG_HOTPLUG_CPU


@@ -775,6 +771,17 @@ void __noreturn cpu_die(void)


#endif /* CONFIG_HOTPLUG_CPU */
#endif /* CONFIG_HOTPLUG_CPU */


void __init smp_fill_possible_mask(void)
{
	unsigned int possible, cpu;

	possible = setup_possible_cpus;
	if (!possible)
		possible = MACHINE_IS_VM ? 64 : nr_cpu_ids;
	for (cpu = 0; cpu < possible && cpu < nr_cpu_ids; cpu++)
		set_cpu_possible(cpu, true);
}

void __init smp_prepare_cpus(unsigned int max_cpus)
void __init smp_prepare_cpus(unsigned int max_cpus)
{
{
	/* request the 0x1201 emergency signal external interrupt */
	/* request the 0x1201 emergency signal external interrupt */