mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Chen Yu <yu.c.chen@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Swapnil Sapkal <Swapnil.Sapkal@amd.com>,
	Aaron Lu <aaron.lu@intel.com>, Tim Chen <tim.c.chen@intel.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
	x86@kernel.org
Subject: Re: [RFC PATCH] sched/fair: Bias runqueue selection towards almost idle prev CPU
Date: Sat, 30 Sep 2023 07:45:38 -0400	[thread overview]
Message-ID: <0f3cfff3-0df4-3cb7-95cb-ea378517e13b@efficios.com> (raw)
In-Reply-To: <ZRfKKxBzfu+kf0tM@chenyu5-mobl2.ccr.corp.intel.com>

On 9/30/23 03:11, Chen Yu wrote:
> Hi Mathieu,
> 
> On 2023-09-29 at 14:33:50 -0400, Mathieu Desnoyers wrote:
>> Introduce the WAKEUP_BIAS_PREV_IDLE scheduler feature. It biases
>> select_task_rq towards the previous CPU if it was almost idle
>> (avg_load <= 0.1%).
> 
> Yes, this is a promising direction IMO. One question is that,
> can cfs_rq->avg.load_avg be used for percentage comparison?
> If I understand correctly, load_avg reflects that more than
> 1 tasks could have been running this runqueue, and the
> load_avg is the direct proportion to the load_weight of that
> cfs_rq. Besides, LOAD_AVG_MAX seems to not be the max value
> that load_avg can reach, it is the sum of
> 1024 * (y + y^1 + y^2 ... )
> 
> For example,
> taskset -c 1 nice -n -20 stress -c 1
> cat /sys/kernel/debug/sched/debug | grep 'cfs_rq\[1\]' -A 12 | grep "\.load_avg"
>    .load_avg                      : 88763
>    .load_avg                      : 1024
> 
> 88763 is higher than LOAD_AVG_MAX=47742

I would have expected the load_avg to be limited to LOAD_AVG_MAX 
somehow, but it appears that it does not happen in practice.

That being said, if the cutoff is really at 0.1% or 0.2% of the real 
max, does it really matter ?

> Maybe the util_avg can be used for precentage comparison I suppose?
[...]
> Or
> return cpu_util_without(cpu_rq(cpu), p) * 1000 <= capacity_orig_of(cpu) ?

Unfortunately using util_avg does not seem to work based on my testing.
Even at utilization thresholds at 0.1%, 1% and 10%.

Based on comments in fair.c:

  * CPU utilization is the sum of running time of runnable tasks plus the
  * recent utilization of currently non-runnable tasks on that CPU.

I think we don't want to include currently non-runnable tasks in the 
statistics we use, because we are trying to figure out if the cpu is a 
idle-enough target based on the tasks which are currently running, for 
the purpose of runqueue selection when waking up a task which is 
considered at that point in time a non-runnable task on that cpu, and 
which is about to become runnable again.

Thanks,

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


  reply	other threads:[~2023-09-30 11:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-29 18:33 Mathieu Desnoyers
2023-09-30  7:11 ` Chen Yu
2023-09-30 11:45   ` Mathieu Desnoyers [this message]
2023-10-09  5:14     ` Chen Yu
2023-10-10 13:49       ` Mathieu Desnoyers
2023-10-10 15:11         ` Vincent Guittot
2023-10-11 10:16         ` Chen Yu
2023-10-12 14:33           ` Mathieu Desnoyers
2023-10-12 15:01             ` Vincent Guittot
2023-10-12 15:56               ` Mathieu Desnoyers
2023-10-12 16:05                 ` Mathieu Desnoyers
2023-10-12 16:24                 ` Vincent Guittot
2023-10-12 16:48                   ` Mathieu Desnoyers
2023-10-12 17:00                     ` Vincent Guittot
2023-10-12 20:06                       ` Mathieu Desnoyers
2023-10-13 16:07                   ` Chen Yu
2023-10-12 15:26           ` Vincent Guittot
2023-10-13 15:37             ` Chen Yu
2023-10-09  5:36     ` Chen Yu
2023-10-10 14:18       ` Mathieu Desnoyers
2023-10-11 10:23         ` Chen Yu

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=0f3cfff3-0df4-3cb7-95cb-ea378517e13b@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=Swapnil.Sapkal@amd.com \
    --cc=aaron.lu@intel.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=gautham.shenoy@amd.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tim.c.chen@intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=x86@kernel.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®