+typedef struct sched_average *sched_average_t;
+
+/*
+ * Scheduler load calculation algorithm
+ *
+ * The scheduler load values provide an estimate of the number of runnable
+ * timeshare threads in the system at various priority bands. The load
+ * ultimately affects the priority shifts applied to all threads in a band
+ * causing them to timeshare with other threads in the system. The load is
+ * maintained in buckets, with each bucket corresponding to a priority band.
+ *
+ * Each runnable thread on the system contributes its load to its priority
+ * band and to the bands above it. The contribution of a thread to the bands
+ * above it is not strictly 1:1 and is weighted based on the priority band
+ * of the thread. The rules of thread load contribution to each of its higher
+ * bands are as follows:
+ *
+ * - DF threads: Upto (2 * NCPUs) threads
+ * - UT threads: Upto NCPUs threads
+ * - BG threads: Upto 1 thread
+ *
+ * To calculate the load values, the various run buckets are sampled (every
+ * sched_load_compute_interval_abs) and the weighted contributions of the the
+ * lower bucket threads are added. The resultant value is plugged into an
+ * exponentially weighted moving average formula:
+ * new-load = alpha * old-load + (1 - alpha) * run-bucket-sample-count
+ * (where, alpha < 1)
+ * The calculations for the scheduler load are done using fixpoint math with
+ * a scale factor of 16 to avoid expensive divides and floating point
+ * operations. The final load values are a smooth curve representative of
+ * the actual number of runnable threads in a priority band.
+ */
+
+/* Maintains the current (scaled for fixpoint) load in various buckets */
+uint32_t sched_load[TH_BUCKET_MAX];