]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/processor.h
xnu-1228.12.14.tar.gz
[apple/xnu.git] / osfmk / kern / processor.h
index 5cb479cd1a3bf87b0b5a116ee4708d424aa258fc..24603cc11be29ec97dac02c797282218f0202cdc 100644 (file)
@@ -84,9 +84,8 @@
 struct processor_set {
        queue_head_t            active_queue;   /* active processors */
        queue_head_t            idle_queue;             /* idle processors */
-       int                                     idle_count;
 
-       processor_t                     low_pri;
+       processor_t                     low_pri, low_count;
 
        int                                     processor_count;
 
@@ -128,6 +127,7 @@ struct processor {
        processor_set_t         processor_set;  /* assigned set */
 
        int                                     current_pri;    /* priority of current thread */
+       int                                     cpu_num;                /* platform numeric id */
 
        timer_call_data_t       quantum_timer;  /* timer for quantum expiration */
        uint64_t                        quantum_end;    /* time when current quantum ends */
@@ -149,7 +149,9 @@ extern processor_t          processor_list;
 extern unsigned int            processor_count;
 decl_simple_lock_data(extern,processor_list_lock)
 
-extern processor_t     master_processor;
+extern uint32_t                        processor_avail_count;
+
+extern processor_t             master_processor;
 
 /*
  *     Processor state is accessed by locking the scheduling lock
@@ -158,9 +160,10 @@ extern processor_t master_processor;
 #define PROCESSOR_OFF_LINE             0       /* Not available */
 #define PROCESSOR_SHUTDOWN             1       /* Going off-line */
 #define PROCESSOR_START                        2       /* Being started */
-#define        PROCESSOR_IDLE                  3       /* Idle */
-#define PROCESSOR_DISPATCHING  4       /* Dispatching (idle -> running) */
-#define        PROCESSOR_RUNNING               5       /* Normal execution */
+#define PROCESSOR_INACTIVE             3       /* Inactive (unavailable) */
+#define        PROCESSOR_IDLE                  4       /* Idle (available) */
+#define PROCESSOR_DISPATCHING  5       /* Dispatching (idle -> active) */
+#define        PROCESSOR_RUNNING               6       /* Normal execution */
 
 extern processor_t     current_processor(void);
 
@@ -184,6 +187,20 @@ MACRO_BEGIN                                                                                                \
        if ((p) != (ps)->low_pri) {                                                     \
                if ((pri) < (ps)->low_pri->current_pri)                 \
                        (ps)->low_pri = (p);                                            \
+               else                                                                                    \
+               if ((ps)->low_pri->state < PROCESSOR_IDLE)              \
+                       (ps)->low_pri = (p);                                            \
+       }                                                                                                       \
+MACRO_END
+
+#define pset_count_hint(ps, p, cnt)            \
+MACRO_BEGIN                                                                                            \
+       if ((p) != (ps)->low_count) {                                           \
+               if ((cnt) < (ps)->low_count->runq.count)                \
+                       (ps)->low_count = (p);                                          \
+               else                                                                                    \
+               if ((ps)->low_count->state < PROCESSOR_IDLE)    \
+                       (ps)->low_count = (p);                                          \
        }                                                                                                       \
 MACRO_END
 
@@ -191,7 +208,7 @@ extern void         processor_bootstrap(void) __attribute__((section("__TEXT, initcode"
 
 extern void            processor_init(
                                        processor_t             processor,
-                                       int                             slot_num,
+                                       int                             cpu_num,
                                        processor_set_t processor_set) __attribute__((section("__TEXT, initcode")));
 
 extern kern_return_t   processor_shutdown(
@@ -219,6 +236,12 @@ extern kern_return_t       processor_info_count(
 #define pset_deallocate(x)
 #define pset_reference(x)
 
+extern void            machine_run_count(
+                                       uint32_t        count);
+
+extern boolean_t       machine_cpu_is_inactive(
+                                               int                             num);
+
 #else  /* MACH_KERNEL_PRIVATE */
 
 __BEGIN_DECLS
@@ -233,9 +256,4 @@ __END_DECLS
 
 #endif /* MACH_KERNEL_PRIVATE */
 
-#ifdef XNU_KERNEL_PRIVATE
-
-extern uint32_t                processor_avail_count;
-
-#endif
 #endif /* _KERN_PROCESSOR_H_ */