mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tianchen Ding <dtcccc@linux.alibaba.com>
To: Abel Wu <wuyun.abel@bytedance.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Barry Song <21cnbao@gmail.com>,
	Benjamin Segall <bsegall@google.com>,
	Chen Yu <yu.c.chen@intel.com>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Mike Galbraith <efault@gmx.de>, Qais Yousef <qyousef@layalina.io>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Yicong Yang <yangyicong@huawei.com>,
	Youssef Esmat <youssefesmat@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] sched/eevdf: Fix vruntime adjustment on reweight
Date: Fri, 1 Mar 2024 18:04:37 +0800	[thread overview]
Message-ID: <72d3352e-e0dc-4527-bc50-a18d00d5195c@linux.alibaba.com> (raw)
In-Reply-To: <38a69b11-d6bb-4f0b-8080-7a051ad58206@bytedance.com>

On 2024/3/1 16:30, Abel Wu wrote:
> On 3/1/24 2:41 PM, Tianchen Ding Wrote:
>> On 2024/2/29 22:25, Abel Wu wrote:
>>> Good catch. And to the best of my knowledge, the answer is YES. The
>>> above Equation in the paper, which is Eq. (20), is based on the
>>> assumption that:
>>>
>>>      "once client 3 leaves, the remaining two clients will
>>>       proportionally support the eventual loss or gain in the
>>>       service time"  -- Page 10
>>>
>>>      "by updating the virtual time according to Eq. (18,19) we
>>>       ensure that the sum over the lags of all active clients
>>>       is always zero"  -- Page 11
>>>
>>> But in Peter's implementation, it is the competitors in the new group
>>> that client 3 later joins in who actually support the effect. So when
>>> client 3 leaves competition with !0-lag in Linux, the rq's sum(lag_i)
>>> is no longer zero.
>>>
>>
>> I've different opinions. According to the comments above avg_vruntime_add(), V
>> is calculated exactly to satisfy sum(lag_i)=0. This is guaranteed by math.
> 
> Yes, you are right. I mixed another fairness issue with this. What I
> was thinking is that considering multiple competition groups (e.g.
> runqueues), the latency bound could be violated, that is someone could
> starve a bit. Say one entity even with positive lag could become less
> competitive if migrated to a higher competitive group.
> 
> Staring at Eq. (20) again, what if we do a fake reweight? I mean let
> the client leave and rejoin at the same time without changing weight?
> IMHO it should have no effects, but according to Eq. (20) the V will
> change to:
> 
>      V' = V + lag(j)/(W - w_j) - lag(j)/W != V
> 
> Have I missed anything?
> 

Good point! I've not ever noticed this conflict.

I tried to modify reweight_entity() to run dequeue_entity() -> adjust se->vlag ->
enqueue_entity(). And I found V do not changed.

The difference is, when doing enqueue_entity(), Peter enlarges the lag in place_entity().
Because after enqueue, the lag will evaporate.
In order to keep the same lag after enqueue, during place_entity(),
the new lag(t) will be enlarged with (W+w_i)/W.

So the Eq. (20) should be:


     V' = V + lag(j)/(W - w_j) - lag'(j)/(W - w_j + w'_j)

     lag'(j) = lag(j) * (W - w_j + w'_j)/(W - w_j)

So we can get

     V' = V + lag(j)/(W - w_j) - lag(j) * (W - w_j + w'_j)/(W - w_j)/(W - w_j + w'_j) = V

So COROLLARY #2 is correct.

  reply	other threads:[~2024-03-01 10:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  9:05 [PATCH 0/4] sched/eevdf: Optimize reweight and pick Abel Wu
2023-11-07  9:05 ` [PATCH 1/4] sched/eevdf: Fix vruntime adjustment on reweight Abel Wu
2023-11-07  9:52   ` Peter Zijlstra
2023-11-14 21:57   ` [tip: sched/urgent] " tip-bot2 for Abel Wu
2023-11-15 15:36   ` [PATCH 1/4] " Yiwei Lin
2023-11-16  4:48     ` Abel Wu
2023-11-16  4:59       ` Yiwei Lin
2023-11-16  9:01         ` Abel Wu
2023-11-16  5:07       ` Abel Wu
2023-11-16  6:51         ` Yiwei Lin
2023-11-16  7:11           ` Abel Wu
2024-02-29  9:24   ` Tianchen Ding
2024-02-29 14:25     ` Abel Wu
2024-03-01  6:41       ` Tianchen Ding
2024-03-01  8:30         ` Abel Wu
2024-03-01 10:04           ` Tianchen Ding [this message]
2023-11-07  9:05 ` [PATCH 2/4] sched/eevdf: Sort the rbtree by virtual deadline Abel Wu
2023-11-07 11:03   ` Peter Zijlstra
2023-11-07 11:06     ` Abel Wu
2023-11-07 23:26   ` Benjamin Segall
2023-11-08  8:51     ` Abel Wu
2023-11-07  9:05 ` [PATCH 3/4] sched/eevdf: O(1) fastpath for task selection Abel Wu
2023-11-07 10:12   ` Abel Wu
2023-11-07 10:42     ` Peter Zijlstra
2023-11-07  9:05 ` [PATCH 4/4] sched/stats: branch statistics for pick_eevdf Abel Wu

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=72d3352e-e0dc-4527-bc50-a18d00d5195c@linux.alibaba.com \
    --to=dtcccc@linux.alibaba.com \
    --cc=21cnbao@gmail.com \
    --cc=bsegall@google.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=efault@gmx.de \
    --cc=gautham.shenoy@amd.com \
    --cc=joel@joelfernandes.org \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=tim.c.chen@linux.intel.com \
    --cc=valentin.schneider@arm.com \
    --cc=wuyun.abel@bytedance.com \
    --cc=yangyicong@huawei.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

Powered by JetHome