Re: [PATCH 1/9] MIPS: Support hard limit of cpu count (nr_cpu_ids)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 04-04-2014 12:11, Huacai Chen wrote:

On MIPS currently, only the soft limit of cpu count (maxcpus) has its
effect, this patch enable the hard limit (nr_cpus) as well. Processor
cores which greater than maxcpus and less than nr_cpus can be taken up
via cpu hotplug. The code is borrowed from X86.

Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>
---
  arch/mips/kernel/setup.c |   18 ++++++++++++++++++
  1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a842154..7ffda01 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -729,6 +729,23 @@ static void __init resource_init(void)
  	}
  }

+static void __init prefill_possible_map(void)
+{
+#ifdef CONFIG_SMP
+	int i, possible = num_possible_cpus();
+
+	if (possible > nr_cpu_ids)
+		possible = nr_cpu_ids;
+
+	for (i = 0; i < possible; i++)
+		set_cpu_possible(i, true);
+	for (; i < NR_CPUS; i++)
+		set_cpu_possible(i, false);
+
+	nr_cpu_ids = possible;
+#endif
> +}
> +

   #ifdef's in the function body are ugly. Instead I'm suggesting:

#ifdef CONFIG_SMP
static void __init prefill_possible_map(void)
{
[...]
}
#else
static inline void prefill_possible_map(void) {}
#endif

WBR, Sergei



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux