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

From: Kayra Cizmeci

Date: Mon Sep 14 2026 - 01:27:36 EST


Hello Chen,

> Hi Kayra,

> I had a try according to your suggestion. It seems that the code becomes more complex
> and brings more headache :-( due to several corner cases. The current version is a simpler
> version with less code IMO. But I agree it looks a little hard to catch up with, so I added
> some comments around account_llc_dequeue() and adjusted the code sequence of clear_delayed()
> to make it easier to understand. Tim, could you please help check if this makes sense?

I can't read your magnificent comment right now, I'm in a hurry. Sorry :-(. (But I will :>)

> @@ -6415,23 +6465,18 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq);

> static void set_delayed(struct sched_entity *se)
> {
> - /*
> - * Drop a task leaving the runnable set. Must run before sched_delayed
> - * is set, or task_pref_llc_runnable() would already exclude it;
> - * clear_delayed() mirrors this after clearing the flag.
> - */
> - if (entity_is_task(se))
> - pref_llc_running_dec(rq_of(cfs_rq_of(se)), task_of(se));
> -
> - se->sched_delayed = 1;
>-
> /*
> * Delayed se of cfs_rq have no tasks queued on them.
> * Do not adjust h_nr_runnable since __dequeue_task()
> * will account it for blocked tasks.
> */
> - if (!entity_is_task(se))
> + if (!entity_is_task(se)) {
> + se->sched_delayed = 1;
> return;
> + }
> +
> + pref_llc_running_dec(rq_of(cfs_rq_of(se)), task_of(se));
> + se->sched_delayed = 1;
>
> for_each_sched_entity(se) {
> struct cfs_rq *cfs_rq = cfs_rq_of(se);

Yeah, I think this is cleaner.

I didn't read the comment tho :>.

Thanks,
Kayra :--)