public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: zihan zhou <15645113830zzh@gmail.com>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V1] sched: Cancel the slice protection of the idle entity
Date: Fri, 7 Feb 2025 13:36:20 +0100	[thread overview]
Message-ID: <20250207123620.GA10324@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250121030628.113497-1-15645113830zzh@gmail.com>

On Tue, Jan 21, 2025 at 11:06:29AM +0800, zihan zhou wrote:
> A wakeup non-idle entity should preempt idle entity at any time,
> but because of the slice protection of the idle entity, the non-idle
> entity has to wait, so just cancel it.
> 
> Signed-off-by: zihan zhou <15645113830zzh@gmail.com>
> ---
>  kernel/sched/fair.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 3e9ca38512de..7777d110d053 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8851,8 +8851,19 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
>  	 * Preempt an idle entity in favor of a non-idle entity (and don't preempt
>  	 * in the inverse case).
>  	 */
> -	if (cse_is_idle && !pse_is_idle)
> +	if (cse_is_idle && !pse_is_idle) {
> +
> +		/*
> +		 * When non-idle entity preempt an idle entity,
> +		 * don't give idle entity slice protection.
> +		 */
> +		if (se->vlag == se->deadline)
> +			se->vlag = se->deadline + 1;
> +
>  		goto preempt;
> +
> +	}

Yes, I suppose we can do this.

  parent reply	other threads:[~2025-02-07 12:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21  3:06 [PATCH V1] sched: Cancel the slice protection of the idle entity zihan zhou
2025-02-07  6:44 ` zihan zhou
2025-02-07 12:36 ` Peter Zijlstra [this message]
2025-02-08  8:29   ` zihan zhou
2025-02-07 14:50 ` Vincent Guittot
2025-02-08  8:21   ` zihan zhou

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=20250207123620.GA10324@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=15645113830zzh@gmail.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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