Re: [PATCH 1/4] sched/cache: Keep nr_pref_llc_running in the runnable domain

From: Kayra Cizmeci

Date: Thu Sep 10 2026 - 18:09:48 EST


Hello Tim,

> So moving the accounting next to (or after) the h_nr_runnable update
> would make task_pref_llc_runnable() return false and skip the
> decrement, leaving nr_pref_llc_running too high.

What I really wanted wasn't getting the accounting next to or after the h_nr_runnable.
If we are updating h_nr_runnable in some way that means we don't need
its check since it's already getting updated. And if it's getting updated
that means on that branch we know how our check should behave since we
are a subset of it. We can skip the delayed check on that way since we are
trying to behave as h_nr_runnable's subset.

> if (entity_is_task(se))
> pref_llc_running_dec(...); /* sched_delayed still 0 */
> se->sched_delayed = 1;
> ...
> for_each_sched_entity(se)
> cfs_rq->h_nr_runnable--; /* sched_delayed already 1 */

For example:

In this code the h_nr_runnable is updated the same way regarding what is sched_delayed.
That means if we want to behave as a subset of it, we don't need the check delayed,
since we check the delayed to be a subset but if h_nr_runnable is decreasing/increasing
we should look into our checks.

My head hurts. Please notify if I'm wrong.

Thanks,
Kayra