From: Vivek Goyal <vgoyal@redhat.com>
To: Divyesh Shah <dpshah@google.com>
Cc: jens.axboe@oracle.com, linux-kernel@vger.kernel.org,
nauman@google.com, ctalbott@google.com
Subject: Re: [PATCH 3/3] blkio: Increment the blkio cgroup stats for real now
Date: Mon, 5 Apr 2010 11:12:38 -0400 [thread overview]
Message-ID: <20100405151237.GD876@redhat.com> (raw)
In-Reply-To: <w2maf41c7c41004021636ia2261ffcv56b6c85928bdee86@mail.gmail.com>
On Fri, Apr 02, 2010 at 04:36:34PM -0700, Divyesh Shah wrote:
> On Fri, Apr 2, 2010 at 12:10 PM, Vivek Goyal <vgoyal@redhat.com> wrote:
> > On Thu, Apr 01, 2010 at 03:01:41PM -0700, Divyesh Shah wrote:
> >> We also add start_time_ns and io_start_time_ns fields to struct request
> >> here to record the time when a request is created and when it is
> >> dispatched to device. We use ns uints here as ms and jiffies are
> >> not very useful for non-rotational media.
> >>
> >> Signed-off-by: Divyesh Shah<dpshah@google.com>
> >> ---
> >>
> >> block/blk-cgroup.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++--
> >> block/blk-cgroup.h | 14 +++++++++--
> >> block/blk-core.c | 6 +++--
> >> block/cfq-iosched.c | 4 ++-
> >> include/linux/blkdev.h | 20 +++++++++++++++-
> >> 5 files changed, 95 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
> >> index ad6843f..9af7257 100644
> >> --- a/block/blk-cgroup.c
> >> +++ b/block/blk-cgroup.c
> >> @@ -15,6 +15,7 @@
> >> #include <linux/kdev_t.h>
> >> #include <linux/module.h>
> >> #include <linux/err.h>
> >> +#include <linux/blkdev.h>
> >> #include "blk-cgroup.h"
> >>
> >> static DEFINE_SPINLOCK(blkio_list_lock);
> >> @@ -55,6 +56,26 @@ struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup)
> >> }
> >> EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup);
> >>
> >> +/*
> >> + * Add to the appropriate stat variable depending on the request type.
> >> + * This should be called with the blkg->stats_lock held.
> >> + */
> >> +void io_add_stat(uint64_t *stat, uint64_t add, unsigned int flags)
> >> +{
> >> + if (flags & REQ_RW)
> >> + stat[IO_WRITE] += add;
> >> + else
> >> + stat[IO_READ] += add;
> >> + /*
> >> + * Everywhere in the block layer, an IO is treated as sync if it is a
> >> + * read or a SYNC write. We follow the same norm.
> >> + */
> >> + if (!(flags & REQ_RW) || flags & REQ_RW_SYNC)
> >> + stat[IO_SYNC] += add;
> >> + else
> >> + stat[IO_ASYNC] += add;
> >> +}
> >> +
> >
> > Hi Divyesh,
> >
> > Can we have any request based information limited to cfq and not put that
> > in blkio-cgroup. The reason being that I am expecting that some kind of
> > max bw policy interface will not necessarily be implemented at CFQ
> > level. We might have to implement it at higher level so that it can
> > work with all dm/md devices. If that's the case, then it might very well
> > be either a bio based interface also.
> >
> > So just keeping that possibility in mind, can we keep blk-cgroup as
> > generic as possible and not necessarily make it dependent on "struct
> > request".
>
> Ok. I do understand the motivation for keeping the request related
> info out of blk-cgroup. Everything except the rq->cmd_flags can be
> easily done away with. Maybe I'll need to have CFQ send the sync and
> direction bits as args to the functions that need it. Not ideal coz
> we'll have functions with many args but I guess its not that bad too.
>
> >
> > If you implement, two dimensional arrays for stats then we can have
> > following function.
> >
> > blkio_add_stat(enum stat_type var enum stat_sub_type var_type, u64 val)
>
> I would want to avoid calls like these from CFQ into the blkcg code
> because many CFQ events trigger update for multiple stats (you'll see
> more with stats in later patchsets) and doing these calls
> independently for each stat would mean that we would also need to grab
> the stats_lock multiple times when we could've avoided that.
I understand the need to club the updates and reduce the need of taking
stats_lock multiple times. I was thinking of any of following.
- Get rid of reset interface per cgroup. Rely on changing ioscheduler on
request queue and that will get rid of stats_lock entirely.
- Can we use a function blkio_add_stat() with variable number of arguments
so that more than one stat can be updated in a single call?
If you have other ideas to implement it without assuming "struct rq" in
blk-cgroup, please do that.
Thanks
Vivek
next prev parent reply other threads:[~2010-04-05 15:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 22:00 [PATCH 0/3] blkio: IO controller stats Divyesh Shah
2010-04-01 22:01 ` [PATCH 1/3] blkio: Remove per-cfqq nr_sectors as we'll be passing Divyesh Shah
2010-04-01 22:01 ` [PATCH 2/3] blkio: Add io controller stats like Divyesh Shah
2010-04-02 18:10 ` Vivek Goyal
2010-04-02 20:53 ` Divyesh Shah
2010-04-05 14:45 ` Vivek Goyal
2010-04-05 22:16 ` Divyesh Shah
2010-04-02 18:17 ` Vivek Goyal
2010-04-02 18:54 ` Divyesh Shah
2010-04-01 22:01 ` [PATCH 3/3] blkio: Increment the blkio cgroup stats for real now Divyesh Shah
2010-04-02 19:10 ` Vivek Goyal
2010-04-02 23:36 ` Divyesh Shah
2010-04-05 15:12 ` Vivek Goyal [this message]
2010-04-05 16:53 ` Divyesh Shah
2010-04-05 17:29 ` Vivek Goyal
2010-04-05 22:06 ` Divyesh Shah
2010-04-02 6:45 ` [PATCH 0/3] blkio: IO controller stats 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=20100405151237.GD876@redhat.com \
--to=vgoyal@redhat.com \
--cc=ctalbott@google.com \
--cc=dpshah@google.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nauman@google.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