public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Vincent Guittot
	<vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	dietmar.eggemann-5wv7dgnIgG8@public.gmane.org,
	rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org,
	bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	mgorman-l3A5Bk7waGM@public.gmane.org,
	bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	vschneid-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	parth-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	qyousef-wp2msK0BRk8tq7phqP6ubQ@public.gmane.org,
	chris.hyser-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	patrick.bellasi-X6neQFFVdzGsTnJN9+BGXg@public.gmane.org,
	David.Laight-JxhZ9S5GRejQT0dZR+AlfA@public.gmane.org,
	pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	pavel-+ZI9xUNit7I@public.gmane.org,
	tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	qperret-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	tim.c.chen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	timj-mXXj517/zsQ@public.gmane.org,
	kprateek.nayak-5C7GfCeVMHo@public.gmane.org,
	yu.c.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	youssefesmat-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	joel-QYYGw3jwrUn5owFQY34kdNi2O/JbrIOy@public.gmane.org
Subject: Re: [PATCH v10 5/9] sched/fair: Take into account latency priority at wakeup
Date: Tue, 21 Feb 2023 14:04:52 +0100	[thread overview]
Message-ID: <Y/TBdB23akBbUjqd@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20230113141234.260128-6-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On Fri, Jan 13, 2023 at 03:12:30PM +0100, Vincent Guittot wrote:
> @@ -6155,6 +6159,35 @@ static int sched_idle_cpu(int cpu)
>  }
>  #endif
>  
> +static void set_next_buddy(struct sched_entity *se);
> +
> +static void check_preempt_from_others(struct cfs_rq *cfs, struct sched_entity *se)
> +{
> +	struct sched_entity *next;
> +
> +	if (se->latency_offset >= 0)
> +		return;
> +
> +	if (cfs->nr_running <= 1)
> +		return;
> +	/*
> +	 * When waking from another class, we don't need to check to preempt at
> +	 * wakeup and don't set next buddy as a candidate for being picked in
> +	 * priority.
> +	 * In case of simultaneous wakeup when current is another class, the
> +	 * latency sensitive tasks lost opportunity to preempt non sensitive
> +	 * tasks which woke up simultaneously.
> +	 */
> +
> +	if (cfs->next)
> +		next = cfs->next;
> +	else
> +		next = __pick_first_entity(cfs);
> +
> +	if (next && wakeup_preempt_entity(next, se) == 1)
> +		set_next_buddy(se);
> +}
> +
>  /*
>   * The enqueue_task method is called before nr_running is
>   * increased. Here we update the fair scheduling stats and
> @@ -6241,14 +6274,15 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
>  	if (!task_new)
>  		update_overutilized_status(rq);
>  
> +	if (rq->curr->sched_class != &fair_sched_class)
> +		check_preempt_from_others(cfs_rq_of(&p->se), &p->se);
> +
>  enqueue_throttle:
>  	assert_list_leaf_cfs_rq(rq);
>  
>  	hrtick_update(rq);
>  }

Hmm.. This sets a next selection when the task gets enqueued while not
running a fair task -- and looses a wakeup preemption opportunity.

Should we perhaps also do this for latency_nice == 0?, in any case I
think this can be moved to its own patch to avoid doing too much in the
one patch. It seems fairly self contained.


  parent reply	other threads:[~2023-02-21 13:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 14:12 [PATCH v10 0/9] Add latency priority for CFS class Vincent Guittot
     [not found] ` <20230113141234.260128-1-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2023-01-13 14:12   ` [PATCH v10 1/9] sched/fair: fix unfairness at wakeup Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 2/9] sched: Introduce latency-nice as a per-task attribute Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 3/9] sched/core: Propagate parent task's latency requirements to the child task Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 4/9] sched: Allow sched_{get,set}attr to change latency_nice of the task Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 5/9] sched/fair: Take into account latency priority at wakeup Vincent Guittot
     [not found]     ` <20230113141234.260128-6-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2023-02-21 12:52       ` Peter Zijlstra
     [not found]         ` <Y/S+qrschy+N+QCQ-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-21 14:12           ` Vincent Guittot
2023-02-21 14:15           ` Peter Zijlstra
     [not found]             ` <Y/TSAivRWwm2LaPh-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-21 14:25               ` Vincent Guittot
2023-02-21 13:04       ` Peter Zijlstra [this message]
     [not found]         ` <Y/TBdB23akBbUjqd-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-21 14:21           ` Vincent Guittot
2023-02-21 14:51             ` Peter Zijlstra
     [not found]             ` <CAKfTPtAk2A8zPgOfpbN0s4LZv+d7ABB9=5tAEMCbVrf263XtjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-21 15:08               ` Peter Zijlstra
     [not found]                 ` <Y/Tecdpxls3N6pO+-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-21 15:34                   ` Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 6/9] sched/fair: Add sched group latency support Vincent Guittot
     [not found]     ` <20230113141234.260128-7-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2023-02-21 15:01       ` Peter Zijlstra
     [not found]         ` <Y/TcwkmiVXJmQ9nw-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-21 15:32           ` Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 7/9] sched/core: Support latency priority with sched core Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 8/9] sched/fair: Add latency list Vincent Guittot
     [not found]     ` <20230113141234.260128-9-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2023-02-21 15:11       ` Peter Zijlstra
     [not found]         ` <Y/TfN1upxApdSERP-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-21 15:42           ` Vincent Guittot
2023-02-22  9:49       ` Peter Zijlstra
     [not found]         ` <Y/XlR+wLtn54CkE4-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-22 11:16           ` Vincent Guittot
     [not found]             ` <CAKfTPtBJD6So-0-S3sgFqTE1HVMypg_S23+uuH6BnGk5atxUKA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-27 13:29               ` Peter Zijlstra
     [not found]                 ` <Y/ywN3Sz33gHO3Vj-Nxj+rRp3nVydTX5a5knrm8zTDFooKrT+cvkQGrU6aU0@public.gmane.org>
2023-02-27 14:55                   ` Vincent Guittot
2023-01-13 14:12   ` [PATCH v10 9/9] sched/fair: remove check_preempt_from_others Vincent Guittot

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=Y/TBdB23akBbUjqd@hirez.programming.kicks-ass.net \
    --to=peterz-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=David.Laight-JxhZ9S5GRejQT0dZR+AlfA@public.gmane.org \
    --cc=bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=chris.hyser-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=dietmar.eggemann-5wv7dgnIgG8@public.gmane.org \
    --cc=joel-QYYGw3jwrUn5owFQY34kdNi2O/JbrIOy@public.gmane.org \
    --cc=joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=kprateek.nayak-5C7GfCeVMHo@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mgorman-l3A5Bk7waGM@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=parth-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=patrick.bellasi-X6neQFFVdzGsTnJN9+BGXg@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=pjt-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=qperret-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=qyousef-wp2msK0BRk8tq7phqP6ubQ@public.gmane.org \
    --cc=rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org \
    --cc=tim.c.chen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=timj-mXXj517/zsQ@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=vschneid-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=youssefesmat-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=yu.c.chen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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