mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Chen Jinghuang <chenjinghuang2@huawei.com>
Cc: <bristot@redhat.com>, <bsegall@google.com>,
	<dietmar.eggemann@arm.com>, <dtcccc@linux.alibaba.com>,
	<gautham.shenoy@amd.com>, <huschle@linux.ibm.com>,
	<juri.lelli@redhat.com>, <linux-kernel@vger.kernel.org>,
	<luis.machado@arm.com>, <mgorman@suse.de>, <mingo@redhat.com>,
	<peterz@infradead.org>, <rostedt@goodmis.org>,
	<vincent.guittot@linaro.org>, <vschneid@redhat.com>,
	<wuyun.abel@bytedance.com>, <xuewen.yan94@gmail.com>,
	<youssefesmat@chromium.org>, <yu.c.chen@intel.com>
Subject: Re: [PATCH] [Question] sched/fair: Task starvation with RUN_TO_PARITY_WAKEUP under group topologies
Date: Mon, 13 Jul 2026 08:55:16 +0530	[thread overview]
Message-ID: <e8f0ab32-3343-4a35-a152-b97ea48dbea7@amd.com> (raw)
In-Reply-To: <20260712113106.2564384-1-chenjinghuang2@huawei.com>

Hello Chen,

On 7/12/2026 5:01 PM, Chen Jinghuang wrote:
> Hi all,
> 
> While adapting the RUN_TO_PARITY_WAKEUP feature on top of mainline v7.2-rc2,
> I encountered a severe task starvation issue under specific cgroup topologies.
> Specifically, a running task completely hogs the CPU and prevents any
> preemption.

I'm assuming you are referring to
https://lore.kernel.org/lkml/20240325060226.1540-2-kprateek.nayak@amd.com/

There was a reason it was not mainlined for this exact issue.

...


> Discussion:
> I'd love to hear your thoughts on how we can fix this issue without losing
> the throughput gains of RUN_TO_PARITY_WAKEUP.

Run your tasks as SCHED_BATCH and they'll forego wakeup preemption.
This is the exact recipe that had helped a bunch of workloads that
suffered throughput degradation from wakeup preemption after EEVDF
was introduced.

If you have well behaved workloads, you can also play around with
custom slice (sched_attr.sched_runtime for fair tasks) which gets
propagated down the cgroup hierarchy and should be better behaved.

> 
> Thanks all.
> 
> Signed-off-by: Chen Jinghuang <chenjinghuang2@huawei.com>
> ---
>  kernel/sched/fair.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d78467ec6ee1..00869624d914 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1157,7 +1157,23 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq, bool protect)
>  		return cfs_rq->next;
>  	}
>  
> -	if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr)))
> +	if (curr && !curr->on_rq)
> +		curr = NULL;
> +
> +	/*
> +	 * When an entity with positive lag wakes up, it pushes the
> +	 * avg_vruntime of the runqueue backwards. This may causes the
> +	 * current entity to be ineligible soon into its run leading to
> +	 * wakeup preemption.
> +	 *
> +	 * To prevent such aggressive preemption of the current running
> +	 * entity during task wakeups, skip the eligibility check if the
> +	 * slice promised to the entity since its selection has not yet
> +	 * elapsed.
> +	 */
> +	if (curr &&
> +	    !(sched_feat(RUN_TO_PARITY_WAKEUP) && protect && protect_slice(curr)) &&
> +	    !entity_eligible(cfs_rq, curr))
>  		curr = NULL;

We also have a bunch of changes in tip:sched/core that improves wakeup
preemption with custom slices. You may want to check them out too:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/log/?h=sched/core

>  
>  	if (curr && protect && protect_slice(curr))

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-07-13  3:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25  6:02 [RFC PATCH 0/1] sched/eevdf: Curb wakeup preemption further K Prateek Nayak
2024-03-25  6:02 ` [RFC PATCH 1/1] sched/eevdf: Skip eligibility check for current entity during wakeup preemption K Prateek Nayak
2024-03-25 15:13   ` Youssef Esmat
2024-03-26  3:06     ` K Prateek Nayak
2024-04-17  6:08       ` K Prateek Nayak
2024-04-24 15:07   ` Peter Zijlstra
2024-04-25  3:34     ` K Prateek Nayak
2026-07-12 11:31   ` [PATCH] [Question] sched/fair: Task starvation with RUN_TO_PARITY_WAKEUP under group topologies Chen Jinghuang
2026-07-13  3:25     ` K Prateek Nayak [this message]
2024-03-28 10:26 ` [RFC PATCH 0/1] sched/eevdf: Curb wakeup preemption further Madadi Vineeth Reddy
2024-03-29  3:16   ` K Prateek Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8f0ab32-3343-4a35-a152-b97ea48dbea7@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=chenjinghuang2@huawei.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dtcccc@linux.alibaba.com \
    --cc=gautham.shenoy@amd.com \
    --cc=huschle@linux.ibm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.machado@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wuyun.abel@bytedance.com \
    --cc=xuewen.yan94@gmail.com \
    --cc=youssefesmat@chromium.org \
    --cc=yu.c.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®