*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* 1 : disable multiple partitions
* >1 : specify number of partitions
*/
-/* NB: we set it to 1 for now, multiple partitions will be enabled after
- * all smp node affinity code landed */
-static int cpu_npartitions = 1;
+static int cpu_npartitions;
CFS_MODULE_PARM(cpu_npartitions, "i", int, 0444, "# of CPU partitions");
/**
void
cfs_cpu_core_siblings(int cpu, cpumask_t *mask)
{
-#if defined(HAVE_TOPOLOGY_CORE_CPUMASK)
+#if defined(HAVE_TOPOLOGY_CORE_CPUMASK) && defined(HAVE_CPUMASK_COPY)
/* return cpumask of cores in the same socket */
cpumask_copy(mask, topology_core_cpumask(cpu));
#elif defined(HAVE_TOPOLOGY_CORE_SIBLINGS)
void
cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
{
-#if defined(HAVE_TOPOLOGY_THREAD_CPUMASK)
+#if defined(HAVE_TOPOLOGY_THREAD_CPUMASK) && defined(HAVE_CPUMASK_COPY)
cpumask_copy(mask, topology_thread_cpumask(cpu));
#elif defined(HAVE_TOPOLOGY_THREAD_SIBLINGS)
*mask = topology_thread_siblings(cpu);
void
cfs_node_to_cpumask(int node, cpumask_t *mask)
{
-#if defined(HAVE_CPUMASK_OF_NODE)
+#if defined(HAVE_CPUMASK_OF_NODE) && defined(HAVE_CPUMASK_COPY)
cpumask_copy(mask, cpumask_of_node(node));
#elif defined(HAVE_NODE_TO_CPUMASK)
*mask = node_to_cpumask(node);
if (ncpt <= 0)
ncpt = rc;
- if (ncpt > rc) {
+ if (ncpt > num_online_cpus() || ncpt > 4 * rc) {
CWARN("CPU partition number %d is larger than suggested "
- "value(%d), your system may have performance"
+ "value (%d), your system may have performance"
"issue or run out of memory while under pressure\n",
ncpt, rc);
}