]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/affinity.c
xnu-3247.1.106.tar.gz
[apple/xnu.git] / osfmk / kern / affinity.c
index eb509545972c7819e9a21e75ca932325016bfc8c..8e6b3ee5a15943d26ac83c78ed55ff95bc1911ce 100644 (file)
@@ -79,6 +79,10 @@ static affinity_set_t affinity_set_remove(affinity_set_t aset, thread_t thread);
  *   kern.affinity_sets_enabled        - disables hinting if cleared
  *   kern.affinity_sets_mapping        - controls cache distribution policy
  * See bsd/kern_sysctl.c
+ *
+ * Affinity sets are not used on embedded, which typically only
+ * has a single pset, and last-processor affinity is
+ * more important than pset affinity.
  */
 boolean_t      affinity_sets_enabled = TRUE;
 int            affinity_sets_mapping = 1;
@@ -386,6 +390,7 @@ affinity_space_free(affinity_space_t aspc)
 {
        assert(queue_empty(&aspc->aspc_affinities));
 
+       lck_mtx_destroy(&aspc->aspc_lock, &task_lck_grp);
        DBG("affinity_space_free(%p)\n", aspc);
        kfree(aspc, sizeof(struct affinity_space));
 }
@@ -528,7 +533,10 @@ affinity_set_place(affinity_space_t aspc, affinity_set_t new_aset)
         */
        queue_iterate(&aspc->aspc_affinities,
                         aset, affinity_set_t, aset_affinities) {
-               set_occupancy[aset->aset_num]++;
+               if(aset->aset_num < num_cpu_asets)
+                       set_occupancy[aset->aset_num]++;
+               else
+                       panic("aset_num = %d in %s\n", aset->aset_num, __FUNCTION__);
        }
 
        /*