Re: [PATCH 05/21] blkio: Introduce the root service tree for cfqgroups

From: Vivek Goyal
Date: Wed Dec 02 2009 - 10:44:50 EST


On Tue, Dec 01, 2009 at 05:25:36AM +0530, Divyesh Shah wrote:
> On Mon, Nov 30, 2009 at 8:29 AM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote:
> > o So far we just had one cfq_group in cfq_data. To create space for more than
> >  one cfq_group, we need to have a service tree of groups where all the groups
> >  can be queued if they have active cfq queues backlogged in these.
> >
> > Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
> > ---
> >  block/cfq-iosched.c |  136 +++++++++++++++++++++++++++++++++++++++++++++++++-
> >  1 files changed, 133 insertions(+), 3 deletions(-)
> >
> > diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> > index a0d0a83..0a284be 100644
> > --- a/block/cfq-iosched.c
> > +++ b/block/cfq-iosched.c
> > @@ -77,8 +77,9 @@ struct cfq_rb_root {
> >        struct rb_root rb;
> >        struct rb_node *left;
> >        unsigned count;
> > +       u64 min_vdisktime;
> >  };
> > -#define CFQ_RB_ROOT    (struct cfq_rb_root) { RB_ROOT, NULL, 0, }
> > +#define CFQ_RB_ROOT    (struct cfq_rb_root) { RB_ROOT, NULL, 0, 0, }
> >
> >  /*
> >  * Per process-grouping structure
> > @@ -156,6 +157,16 @@ enum wl_type_t {
> >
> >  /* This is per cgroup per device grouping structure */
> >  struct cfq_group {
> > +       /* group service_tree member */
> > +       struct rb_node rb_node;
> > +
> > +       /* group service_tree key */
> > +       u64 vdisktime;
> > +       bool on_st;
> > +
> > +       /* number of cfqq currently on this group */
> > +       int nr_cfqq;
> > +
> >        /*
> >         * rr lists of queues with requests, onle rr for each priority class.
> >         * Counts are embedded in the cfq_rb_root
> > @@ -169,6 +180,8 @@ struct cfq_group {
> >  */
> >  struct cfq_data {
> >        struct request_queue *queue;
> > +       /* Root service tree for cfq_groups */
> > +       struct cfq_rb_root grp_service_tree;
> >        struct cfq_group root_group;
> >
> >        /*
> > @@ -251,6 +264,9 @@ static struct cfq_rb_root *service_tree_for(struct cfq_group *cfqg,
> >                                            enum wl_type_t type,
> >                                            struct cfq_data *cfqd)
> >  {
> > +       if (!cfqg)
> > +               return NULL;
> > +
> >        if (prio == IDLE_WORKLOAD)
> >                return &cfqg->service_tree_idle;
> >
> > @@ -587,6 +603,17 @@ static struct cfq_queue *cfq_rb_first(struct cfq_rb_root *root)
> >        return NULL;
> >  }
> >
> > +static struct cfq_group *cfq_rb_first_group(struct cfq_rb_root *root)
> > +{
> > +       if (!root->left)
> > +               root->left = rb_first(&root->rb);
> > +
> > +       if (root->left)
> > +               return rb_entry(root->left, struct cfq_group, rb_node);
>
> Can you please define a cfqg_entry macro and reuse that at different
> places in the code?
> #define cfqg_entry(ptr) rb_entry(ptr, struct cfq_group, rb_node)

Ok, I have introduced rb_entry_cfqg() along the lines of rb_entry_rq().

Changes are there in two patches. Reposting these patches in same thread
soon.

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/