*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* i.e: "0[0,1,2,3] 1[4,5,6,7]", number before bracket is CPU partition ID,
* number in bracket is processor ID (core or HT)
*
- * i.e: "N 0[0,1] 1[2,3]" the first character 'n' means numbers in bracket
+ * i.e: "N 0[0,1] 1[2,3]" the first character 'N' means numbers in bracket
* are NUMA node ID, number before bracket is CPU partition ID.
*
* NB: If user specified cpu_pattern, cpu_npartitions will be ignored
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);
#else
rc = set_cpus_allowed_ptr(cfs_current(), cpumask);
#endif
-#ifdef HAVE_SET_MEMS_ALLOWED
set_mems_allowed(*nodemask);
-#endif
if (rc == 0)
cfs_schedule(); /* switch to allowed CPU */
return rc;
}
- /* don't need to set affinity baecause all online CPUs are covered */
+ /* don't need to set affinity because all online CPUs are covered */
return 0;
}
EXPORT_SYMBOL(cfs_cpt_bind);
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);
}