mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre Gondois <pierre.gondois@arm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>,
	mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	lukasz.luba@arm.com, rafael.j.wysocki@intel.com,
	linux-kernel@vger.kernel.org
Cc: qyousef@layalina.io, hongyan.xia2@arm.com,
	christian.loehle@arm.com, qperret@google.com
Subject: Re: [PATCH 5/7 v2] sched/fair: Add push task callback for EAS
Date: Thu, 16 Jan 2025 18:34:30 +0100	[thread overview]
Message-ID: <0c3312f8-4e1c-49df-a084-8c236c9f7f53@arm.com> (raw)
In-Reply-To: <20241217160720.2397239-6-vincent.guittot@linaro.org>

Hello Vincent,

On 12/17/24 17:07, Vincent Guittot wrote:
> EAS is based on wakeup events to efficiently place tasks on the system, but
> there are cases where a task will not have wakeup events anymore or at a
> far too low pace. For such situation, we can take advantage of the task
> being put back in the enqueued list to check if it should be migrated on
> another CPU.
> 
> Wake up events remain the main way to migrate tasks but we now detect
> situation where a task is stuck on a CPU by checking that its utilization
> is larger than the max available compute capacity (max cpu capacity or
> uclamp max setting)

It seems there are 2 distinct cases:
a- The task is alone on a rq
b- The task shares the rq and is enqueued/dequeued

a. doesn't seem to need any of the push functions, and b. doesn't seem to
need any of the misfit functions. Maybe it's worth splitting the patch in 2.

> 
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
>   kernel/sched/fair.c  | 206 +++++++++++++++++++++++++++++++++++++++++++
>   kernel/sched/sched.h |   2 +
>   2 files changed, 208 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index cd046e8216a9..2affc063da55 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7088,6 +7088,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
>   	hrtick_update(rq);
>   }
>   
> +static void dequeue_pushable_task(struct rq *rq, struct task_struct *p);
>   static void set_next_buddy(struct sched_entity *se);
>   
>   /*
> @@ -7118,6 +7119,9 @@ static int dequeue_entities(struct rq *rq, struct sched_entity *se, int flags)
>   		h_nr_idle = task_has_idle_policy(p);
>   		if (task_sleep || task_delayed || !se->sched_delayed)
>   			h_nr_runnable = 1;
> +
> +		if (task_sleep || task_on_rq_migrating(p))
> +			dequeue_pushable_task(rq, p);
>   	} else {
>   		cfs_rq = group_cfs_rq(se);
>   		slice = cfs_rq_min_slice(cfs_rq);
> @@ -8617,6 +8621,182 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
>   	return target;
>   }
>   
> +static inline bool task_misfit_cpu(struct task_struct *p, int cpu)
> +{
> +	unsigned long max_capa = get_actual_cpu_capacity(cpu);
> +	unsigned long util = task_util_est(p);
> +
> +	max_capa = min(max_capa, uclamp_eff_value(p, UCLAMP_MAX));
> +	util = max(util, task_runnable(p));
> +
> +	/*
> +	 * Return true only if the task might not sleep/wakeup because of a low
> +	 * compute capacity. Tasks, which wake up regularly, will be handled by
> +	 * feec().
> +	 */

NIT:
On a little CPU with min_OPP=256 and max_OPP=512,
a task with a util=100 and U_Max=10 will trigger this condition.
However:
- the task is already well placed from a power PoV
- the tasks has opportunities to sleep/wake-up
Shouldn't we ideally take:

unsigned long max_capa;
max_capa = max(min_capa(cpu), uclamp_eff_value(p, UCLAMP_MAX));
max_capa = min(get_actual_cpu_capacity(cpu), max_capa);

with min_capa(cpu) returning 256 in this case, i.e. the CPU capacity at the
lowest OPP ?

> +	return (util > max_capa);
> +}
> +

[...]

  reply	other threads:[~2025-01-16 17:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 16:07 [PATCH 0/7 v2] sched/fair: Rework EAS to handle more cases Vincent Guittot
2024-12-17 16:07 ` [PATCH 1/7 v2] sched/fair: Filter false overloaded_group case for EAS Vincent Guittot
2024-12-17 19:15   ` Dhaval Giani
2024-12-17 16:07 ` [PATCH 2/7 v2] energy model: Add a get previous state function Vincent Guittot
2024-12-17 16:07 ` [PATCH 3/7 v2] sched/fair: Rework feec() to use cost instead of spare capacity Vincent Guittot
2024-12-24 16:46   ` Luis Machado
2024-12-17 16:07 ` [PATCH 4/7 v2] energy model: Remove unused em_cpu_energy() Vincent Guittot
2024-12-18 14:59   ` Christian Loehle
2024-12-17 16:07 ` [PATCH 5/7 v2] sched/fair: Add push task callback for EAS Vincent Guittot
2025-01-16 17:34   ` Pierre Gondois [this message]
2025-01-20 15:50     ` Vincent Guittot
2024-12-17 16:07 ` [PATCH 6/7 v2] sched/fair: Add misfit case to " Vincent Guittot
2025-01-16 17:35   ` Pierre Gondois
2025-01-20 15:50     ` Vincent Guittot
2024-12-17 16:07 ` [PATCH 7/7 v2] sched/fair: Update overutilized detection Vincent Guittot
2025-01-17 10:27   ` Pierre Gondois
2025-01-20 15:50     ` Vincent Guittot
2024-12-18 14:06 ` [PATCH 0/7 v2] sched/fair: Rework EAS to handle more cases Christian Loehle
2024-12-19 16:22   ` 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=0c3312f8-4e1c-49df-a084-8c236c9f7f53@arm.com \
    --to=pierre.gondois@arm.com \
    --cc=bsegall@google.com \
    --cc=christian.loehle@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=hongyan.xia2@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=qyousef@layalina.io \
    --cc=rafael.j.wysocki@intel.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

all inboxes | Powered by JetHome®