All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Tejun Heo <tj@kernel.org>
Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org,
	kernel-team@fb.com, Dan Schatzberg <dschatzberg@fb.com>
Subject: Re: [PATCH block-5.13] blk-iocost: fix weight updates of inner active iocgs
Date: Tue, 11 May 2021 20:50:58 -0600	[thread overview]
Message-ID: <204404df-1ef8-d31b-8d4b-21f77810b774@kernel.dk> (raw)
In-Reply-To: <YJsxnLZV1MnBcqjj@slm.duckdns.org>

On 5/11/21 7:38 PM, Tejun Heo wrote:
> When the weight of an active iocg is updated, weight_updated() is called
> which in turn calls __propagate_weights() to update the active and inuse
> weights so that the effective hierarchical weights are update accordingly.
> 
> The current implementation is incorrect for inner active nodes. For an
> active leaf iocg, inuse can be any value between 1 and active and the
> difference represents how much the iocg is donating. When weight is updated,
> as long as inuse is clamped between 1 and the new weight, we're alright and
> this is what __propagate_weights() currently implements.
> 
> However, that's not how an active inner node's inuse is set. An inner node's
> inuse is solely determined by the ratio between the sums of inuse's and
> active's of its children - ie. they're results of propagating the leaves'
> active and inuse weights upwards. __propagate_weights() incorrectly applies
> the same clamping as for a leaf when an active inner node's weight is
> updated. Consider a hierarchy which looks like the following with saturating
> workloads in AA and BB.
> 
>      R
>    /   \
>   A     B
>   |     |
>  AA     BB
> 
> 1. For both A and B, active=100, inuse=100, hwa=0.5, hwi=0.5.
> 
> 2. echo 200 > A/io.weight
> 
> 3. __propagate_weights() update A's active to 200 and leave inuse at 100 as
>    it's already between 1 and the new active, making A:active=200,
>    A:inuse=100. As R's active_sum is updated along with A's active,
>    A:hwa=2/3, B:hwa=1/3. However, because the inuses didn't change, the
>    hwi's remain unchanged at 0.5.
> 
> 4. The weight of A is now twice that of B but AA and BB still have the same
>    hwi of 0.5 and thus are doing the same amount of IOs.
> 
> Fix it by making __propgate_weights() always calculate the inuse of an
> active inner iocg based on the ratio of child_inuse_sum to child_active_sum.

Applied, thanks.

-- 
Jens Axboe


WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-team-b10kYP2dOMg@public.gmane.org,
	Dan Schatzberg <dschatzberg-b10kYP2dOMg@public.gmane.org>
Subject: Re: [PATCH block-5.13] blk-iocost: fix weight updates of inner active iocgs
Date: Tue, 11 May 2021 20:50:58 -0600	[thread overview]
Message-ID: <204404df-1ef8-d31b-8d4b-21f77810b774@kernel.dk> (raw)
In-Reply-To: <YJsxnLZV1MnBcqjj-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>

On 5/11/21 7:38 PM, Tejun Heo wrote:
> When the weight of an active iocg is updated, weight_updated() is called
> which in turn calls __propagate_weights() to update the active and inuse
> weights so that the effective hierarchical weights are update accordingly.
> 
> The current implementation is incorrect for inner active nodes. For an
> active leaf iocg, inuse can be any value between 1 and active and the
> difference represents how much the iocg is donating. When weight is updated,
> as long as inuse is clamped between 1 and the new weight, we're alright and
> this is what __propagate_weights() currently implements.
> 
> However, that's not how an active inner node's inuse is set. An inner node's
> inuse is solely determined by the ratio between the sums of inuse's and
> active's of its children - ie. they're results of propagating the leaves'
> active and inuse weights upwards. __propagate_weights() incorrectly applies
> the same clamping as for a leaf when an active inner node's weight is
> updated. Consider a hierarchy which looks like the following with saturating
> workloads in AA and BB.
> 
>      R
>    /   \
>   A     B
>   |     |
>  AA     BB
> 
> 1. For both A and B, active=100, inuse=100, hwa=0.5, hwi=0.5.
> 
> 2. echo 200 > A/io.weight
> 
> 3. __propagate_weights() update A's active to 200 and leave inuse at 100 as
>    it's already between 1 and the new active, making A:active=200,
>    A:inuse=100. As R's active_sum is updated along with A's active,
>    A:hwa=2/3, B:hwa=1/3. However, because the inuses didn't change, the
>    hwi's remain unchanged at 0.5.
> 
> 4. The weight of A is now twice that of B but AA and BB still have the same
>    hwi of 0.5 and thus are doing the same amount of IOs.
> 
> Fix it by making __propgate_weights() always calculate the inuse of an
> active inner iocg based on the ratio of child_inuse_sum to child_active_sum.

Applied, thanks.

-- 
Jens Axboe


  reply	other threads:[~2021-05-12  2:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12  1:38 [PATCH block-5.13] blk-iocost: fix weight updates of inner active iocgs Tejun Heo
2021-05-12  2:50 ` Jens Axboe [this message]
2021-05-12  2:50   ` Jens Axboe

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=204404df-1ef8-d31b-8d4b-21f77810b774@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=dschatzberg@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.