Fundamentals 14 min read

Why Energy‑Aware Scheduling Falls Short: Inside CPU Frequency, Power Modeling, and Scheduler Limits

This article examines the challenges of Energy Aware Scheduling on big‑LITTLE CPUs, detailing how frequency prediction, power calculation, cache hierarchy, out‑of‑order execution, and branch prediction affect task placement decisions, and why the resulting models often remain inaccurate and unreliable.

OPPO Kernel Craftsman
OPPO Kernel Craftsman
OPPO Kernel Craftsman
Why Energy‑Aware Scheduling Falls Short: Inside CPU Frequency, Power Modeling, and Scheduler Limits

Energy Aware Scheduling (EAS) Overview

EAS aims to decide whether a small task should run on a big core or a little core by predicting CPU frequency and power consumption for each option.

The process involves:

Assuming the task runs on a little core, predict its frequency.

Calculate power based on the predicted frequency.

Repeat the prediction for a big core.

Compare the estimated power of both cores and choose the lower‑power option.

1. Predicting Frequency

For a given CPU, the raw utilization (raw_util) and task‑specific utilization (util_t) are summed to obtain total utilization, which is then mapped to a frequency using the

map_util_freq

function:

freq = map_util_freq(max_util, ps->frequency, scale_cpu);

The mapping is linear, but real‑world frequency‑to‑execution‑time relationships are often non‑linear, as shown by render‑thread timing curves and Dhrystone benchmarks.

1.1 Cache Miss Impact

Memory hierarchy affects latency dramatically; a miss in L1 cache can force a fetch from DDR memory with ~150 ns delay, stalling the CPU for hundreds of cycles.

memory hierarchy diagram
memory hierarchy diagram

1.2 Out‑of‑Order Execution

To hide stalls caused by cache misses, CPUs execute independent instructions out of order. Example pseudo‑code demonstrates reordering independent assignments while preserving data dependencies.

int a, b, c, d, e, f;
a = b + c;
d = e + f; // can execute before a = b + c if a depends on b/c

However, dependent instructions must respect order to avoid incorrect results.

1.3 Branch Prediction

Modern CPUs use speculative execution to guess the outcome of branches, keeping pipelines full. Mis‑predictions cause pipeline flushes and wasted power, so high prediction accuracy (>90%) is essential.

Linux kernel code uses

likely()

and

unlikely()

macros to guide the compiler’s branch‑prediction hints:

if (likely(lw->inv_weight)) {
    return;
}

2. Power Calculation

After frequency prediction, power is estimated using an energy model that multiplies capacitance, frequency, and voltage squared (P = C·f·V²). The kernel provides functions like

compute_energy

to calculate energy based on utilization and frequency:

static inline unsigned long compute_energy(struct energy_env *eenv, struct perf_domain *pd,
    struct cpumask *pd_cpus, struct task_struct *p, int dst_cpu) {
    unsigned long max_util = eenv_pd_max_util(eenv, pd_cpus, p, dst_cpu);
    unsigned long busy_time = eenv->pd_busy_time;
    if (dst_cpu >= 0)
        busy_time = min(eenv->pd_cap, busy_time + eenv->task_busy_time);
    return em_cpu_energy(pd->em_pd, max_util, busy_time, eenv->cpu_cap);
}

Power models also consider static leakage current, which grows with newer process nodes (7 nm → 5 nm → 3 nm) and temperature, creating a feedback loop where higher temperature increases leakage, raising power consumption.

temperature vs power graph
temperature vs power graph

Despite sophisticated models, many assumptions (historical load, linear frequency scaling) are inaccurate, leading to questionable effectiveness of EAS.

CPU schedulingenergy aware schedulingfrequency predictionout-of-order executionpower modeling
OPPO Kernel Craftsman
Written by

OPPO Kernel Craftsman

Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.