summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/cpu.c
diff options
context:
space:
mode:
authorPavel Tatashin <Pavel.Tatashin@Sun.COM>2010-07-26 07:24:36 -0700
committerPavel Tatashin <Pavel.Tatashin@Sun.COM>2010-07-26 07:24:36 -0700
commitb52a336e0ccd9ef29cd11bb3c7e530788483ee04 (patch)
tree44860ca7d9818e34d5b04eebf4f0408eb473a34f /usr/src/uts/common/os/cpu.c
parentb8066721980a58171ec24c6b5ed2f438e5a1dd26 (diff)
downloadillumos-gate-b52a336e0ccd9ef29cd11bb3c7e530788483ee04.tar.gz
6948098 freemem_lock contention causes poor concurrent DISM MC_LOCK/MC_UNLOCK performance
6946742 sfmmu_mlspl_enter lock contention on mml_table 6956454 ani_free_pool lock contention with multi processed ISM
Diffstat (limited to 'usr/src/uts/common/os/cpu.c')
-rw-r--r--usr/src/uts/common/os/cpu.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr/src/uts/common/os/cpu.c b/usr/src/uts/common/os/cpu.c
index 62e8eeb2fe..b6c9d2ede3 100644
--- a/usr/src/uts/common/os/cpu.c
+++ b/usr/src/uts/common/os/cpu.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
@@ -91,8 +90,8 @@ static int cpu_state_change_hooks(int, cpu_setup_t, cpu_setup_t);
/*
* cpu_lock protects ncpus, ncpus_online, cpu_flag, cpu_list, cpu_active,
- * and dispatch queue reallocations. The lock ordering with respect to
- * related locks is:
+ * max_cpu_seqid_ever, and dispatch queue reallocations. The lock ordering with
+ * respect to related locks is:
*
* cpu_lock --> thread_free_lock ---> p_lock ---> thread_lock()
*
@@ -133,6 +132,13 @@ int boot_ncpus = -1;
*/
processorid_t max_cpuid = NCPU - 1;
+/*
+ * Maximum cpu_seqid was given. This number can only grow and never shrink. It
+ * can be used to optimize NCPU loops to avoid going through CPUs which were
+ * never on-line.
+ */
+processorid_t max_cpu_seqid_ever = 0;
+
int ncpus = 1;
int ncpus_online = 1;
@@ -1758,6 +1764,10 @@ cpu_add_unit(cpu_t *cp)
continue;
CPUSET_ADD(cpu_seqid_inuse, seqid);
cp->cpu_seqid = seqid;
+
+ if (seqid > max_cpu_seqid_ever)
+ max_cpu_seqid_ever = seqid;
+
ASSERT(ncpus < max_ncpus);
ncpus++;
cp->cpu_cache_offset = KMEM_CPU_CACHE_OFFSET(cp->cpu_seqid);