linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@vger.kernel.org, cgroups@vger.kernel.org,
	newella@fb.com
Subject: [PATCHSET block/for-next] blk-iocost: Implement absolute debt handling
Date: Wed,  4 Sep 2019 12:45:51 -0700	[thread overview]
Message-ID: <20190904194556.2984857-1-tj@kernel.org> (raw)

Currently, when a given cgroup doesn't have enough budget, a forced or
merged bio will advance the cgroup's vtime by the cost calculated
according to the hierarchical weight at the time of issue.  Once vtime
is advanced, how the cgroup's weight changes doesn't matter.  It has
to wait until global vtime catches up with the cgroup's.

This means that the cost is calculated based on the hweight at the
time of issuing but may later be paid at the wrong hweight.  This, for
example, can lead to a scenario like the following.

1. A cgroup with a very low hweight runs out of budget.

2. A storm of swap-out happens on it.  All of them are scaled
   according to the current low hweight and charged to vtime pushing
   it to a far future.

3. All other cgroups go idle and now the above cgroup has access to
   the whole device.  However, because vtime is already wound using
   the past low hweight, what its current hweight is doesn't matter
   until global vtime catches up to the local vtime.

4. As a result, either vrate gets ramped up extremely or the IOs stall
   while the underlying device is idle.

This patchset fixes the behavior by accounting the cost of forced or
merged bios in absolute vtime rather than cgroup-relative.  This
allows the cgroup to pay back the debt with whatever actual budget it
has each period removing the hweight discrepancy.

Note that !forced bios' costs are already accounted in absolute vtime.
This patchset puts forced charges on the same ground.

This patchset contains the following five patches and is on top of the
current linux-block.git for-next 35e7ae82f62b ("Merge branch
'for-5.4/block' into for-next").

 0001-blk-iocost-Account-force-charged-overage-in-absolute.patch
 0002-blk-iocost-Don-t-let-merges-push-vtime-into-the-futu.patch
 0003-iocost_monitor-Always-use-strings-for-json-values.patch
 0004-iocost_monitor-Report-more-info-with-higher-accuracy.patch
 0005-iocost_monitor-Report-debt.patch

0001-0002 implement absolute debt handling.  0003-0005 improve the
monitoring script and add debt reporting.

This patchset is also available in the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git iocost-vdebt

diffstat follows.  Thanks.

 block/blk-iocost.c             |   93 +++++++++++++++++++++++++++++++++--------
 tools/cgroup/iocost_monitor.py |   61 ++++++++++++++------------
 2 files changed, 110 insertions(+), 44 deletions(-)

--
tejun


             reply	other threads:[~2019-09-04 19:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 19:45 Tejun Heo [this message]
2019-09-04 19:45 ` [PATCH 1/5] blk-iocost: Account force-charged overage in absolute vtime Tejun Heo
2019-09-04 19:45 ` [PATCH 2/5] blk-iocost: Don't let merges push vtime into the future Tejun Heo
2019-09-04 19:45 ` [PATCH 3/5] iocost_monitor: Always use strings for json values Tejun Heo
2019-09-04 19:45 ` [PATCH 4/5] iocost_monitor: Report more info with higher accuracy Tejun Heo
2019-09-04 19:45 ` [PATCH 5/5] iocost_monitor: Report debt Tejun Heo
2019-09-10 18:32 ` [PATCHSET block/for-next] blk-iocost: Implement absolute debt handling 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=20190904194556.2984857-1-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=kernel-team@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=newella@fb.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;
as well as URLs for NNTP newsgroup(s).