Linux Container Development
 help / color / mirror / Atom feed
  • [parent not found: <1356726946-26037-21-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-16-git-send-email-tj@kernel.org>]
  • [parent not found: <20130102182037.GC4306@redhat.com>]
  • [parent not found: <1356726946-26037-12-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-13-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-15-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-17-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-20-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-23-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-24-git-send-email-tj@kernel.org>]
  • [parent not found: <1356726946-26037-25-git-send-email-tj@kernel.org>]
  • * [PATCHSET] block: implement blkcg hierarchy support in cfq, take#2
    @ 2012-12-28 20:35 Tejun Heo
      0 siblings, 0 replies; 56+ messages in thread
    From: Tejun Heo @ 2012-12-28 20:35 UTC (permalink / raw)
      To: lizefan-hv44wF8Li93QT0dZR+AlfA, axboe-tSWWG44O7X1aa/9Udqfwiw,
    	vgoyal-H+wXaHxf7aLQT0dZR+AlfA
      Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
    	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
    	rni-hpIqsD4AKlfQT0dZR+AlfA, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
    	ctalbott-hpIqsD4AKlfQT0dZR+AlfA
    
    Hello,
    
    This is the second iteration to implement blkcg hierarchy support in
    cfq-iosched.  Changes from the first task[L] are
    
    * Vivek's cfq cleanup patches are included in the series for
      convenience.
    
    * Divide by zero bug when !CONFIG_CFQ_GROUP_IOSCHED reported by
      Fengguang fixed.
    
    * Updated to reflect Vivek's reviews - renames & documentation.
    
    * Recursive stats no longer forget stats from dead descendants.  This
      turned out to be more complex than I wished involving implementing
      policy on/offline callbacks.
    
    cfq-iosched is currently utterly broken in how it handles cgroup
    hierarchy.  It ignores the hierarchy structure and just treats every
    blkcgs equally.  This is simply broken.  This breakage makes blkcg
    behave very differently from other properly-hierarchical controllers
    and makes it impossible to give any uniform interpretation to the
    hierarchy, which in turn makes it impossible to implement unified
    hierarchy.
    
    Given the relative simplicity of cfqg scheduling, implementing proper
    hierarchy support isn't that difficult.  All that's necessary is
    determining how much fraction each cfqg on the service tree has claim
    to considering the hierarchy.  The calculation can be done by
    maintaining the sum of active weights at each level and compounding
    the ratios from the cfqg in question to root.  The overhead isn't
    significant.  Tree traversals happen only when cfqgs are added or
    removed from the service tree and they are from the cfqg being
    modified to the root.
    
    There are some design choices which are worth mentioning.
    
    * Internal (non-leaf) cfqgs w/ tasks treat the tasks as a single unit
      competeting against the children cfqgs.  New config knobs -
      blkio.leaf_weight[_device] - are added to configure the weight of
      these tasks.  Another way to look at it is that each cfqg has a
      hidden leaf child node attached to it which hosts all tasks and
      leaf_weight controls the weight of that hidden node.
    
      Treating cfqqs and cfqgs as equals doesn't make much sense to me and
      is hairy - we need to establish ioprio to weight mapping and the
      weights fluctuate as processes fork and exit.  This becomes hairier
      when considering multiple controllers, Such mappings can't be
      established consistently across different controllers and the
      weights are given out differently - ie. blkcg give weights out to
      io_contexts while cpu to tasks, which may share io_contexts.  It's
      difficult to make sense of what's going on.
    
      The goal is to bring cpu, currently the only other controller which
      implements weight based resource allocation, to similar behavior.
    
    * The existing stats aren't converted to hierarchical but new
      hierarchical ones are added.  There isn't a way to do that w/o
      introducing nasty silent surprises to the existing flat hierarchy
      users, so while being a bit clumsy, I can't see a better way.
    
    * I based it on top of Vivek's cleanup patchset[1] but not the cfqq,
      cfqg scheduling unification patchset.  I don't think it's necessary
      or beneficial to mix the two and would really like to avoid messing
      with !blkcg scheduling logic.
    
    The hierarchical scheduling itself is fairly simple.  The cfq part is
    only ~260 lines with ~60 lines being comment, and the hierarchical
    weight scaling is really straight-forward.
    
    This patchset contains the following 24 patches.
    
     0001-cfq-iosched-Properly-name-all-references-to-IO-class.patch
     0002-cfq-iosched-More-renaming-to-better-represent-wl_cla.patch
     0003-cfq-iosched-Rename-service_tree-to-st-at-some-places.patch
     0004-cfq-iosched-Rename-few-functions-related-to-selectin.patch
     0005-cfq-iosched-Get-rid-of-unnecessary-local-variable.patch
     0006-cfq-iosched-Print-sync-noidle-information-in-blktrac.patch
     0007-blkcg-fix-minor-bug-in-blkg_alloc.patch
     0008-blkcg-reorganize-blkg_lookup_create-and-friends.patch
     0009-blkcg-cosmetic-updates-to-blkg_create.patch
     0010-blkcg-make-blkcg_gq-s-hierarchical.patch
     0011-cfq-iosched-add-leaf_weight.patch
     0012-cfq-iosched-implement-cfq_group-nr_active-and-childr.patch
     0013-cfq-iosched-implement-hierarchy-ready-cfq_group-char.patch
     0014-cfq-iosched-convert-cfq_group_slice-to-use-cfqg-vfra.patch
     0015-cfq-iosched-enable-full-blkcg-hierarchy-support.patch
     0016-blkcg-add-blkg_policy_data-plid.patch
     0017-blkcg-implement-blkcg_policy-on-offline_pd_fn-and-bl.patch
     0018-blkcg-s-blkg_rwstat_sum-blkg_rwstat_total.patch
     0019-blkcg-implement-blkg_-rw-stat_recursive_sum-and-blkg.patch
     0020-block-RCU-free-request_queue.patch
     0021-blkcg-make-blkcg_print_blkgs-grab-q-locks-instead-of.patch
     0022-cfq-iosched-separate-out-cfqg_stats_reset-from-cfq_p.patch
     0023-cfq-iosched-collect-stats-from-dead-cfqgs.patch
     0024-cfq-iosched-add-hierarchical-cfq_group-statistics.patch
    
    0001-0006 are Vivek's cfq cleanup patches.
    
    0007-0009 are prep patches.
    
    0010 makes blkcg core always allocate non-leaf blkgs so that any given
    blkg is guaranteed to have all its ancestor blkgs to the root.
    
    0011-0012 prepare for hierarchical scheduling.
    
    0013-0014 implement hierarchy-ready cfqg scheduling.
    
    0015 enbles hierarchical scheduling.
    
    0016-0022 prepare for hierarchical stats.
    
    0023-0024 implement hierarchical stats.
    
    This patchset is on top of linus#master (ecccd1248d ("mm: fix null
    pointer dereference in wait_iff_congested()")).
    
    and available in the following git branch.
    
     git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git blkcg-cfq-hierarchy
    
    Thanks.
    
     Documentation/block/cfq-iosched.txt |   58 +++
     block/blk-cgroup.c                  |  276 +++++++++++++--
     block/blk-cgroup.h                  |   68 +++
     block/blk-sysfs.c                   |    9 
     block/cfq-iosched.c                 |  627 +++++++++++++++++++++++++++++-------
     include/linux/blkdev.h              |    2 
     6 files changed, 877 insertions(+), 163 deletions(-)
    
    --
    tejun
    
    [L] http://thread.gmane.org/gmane.linux.kernel.cgroups/5440
    [1] https://lkml.org/lkml/2012/10/3/502
    
    ^ permalink raw reply	[flat|nested] 56+ messages in thread

    end of thread, other threads:[~2013-01-08 18:28 UTC | newest]
    
    Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <1356726946-26037-1-git-send-email-tj@kernel.org>
         [not found] ` <1356726946-26037-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2012-12-28 20:35   ` [PATCH 01/24] cfq-iosched: Properly name all references to IO class Tejun Heo
    2012-12-28 20:35   ` [PATCH 02/24] cfq-iosched: More renaming to better represent wl_class and wl_type Tejun Heo
    2012-12-28 20:35   ` [PATCH 03/24] cfq-iosched: Rename "service_tree" to "st" at some places Tejun Heo
    2012-12-28 20:35   ` [PATCH 04/24] cfq-iosched: Rename few functions related to selecting workload Tejun Heo
    2012-12-28 20:35   ` [PATCH 05/24] cfq-iosched: Get rid of unnecessary local variable Tejun Heo
    2012-12-28 20:35   ` [PATCH 06/24] cfq-iosched: Print sync-noidle information in blktrace messages Tejun Heo
    2012-12-28 20:35   ` [PATCH 07/24] blkcg: fix minor bug in blkg_alloc() Tejun Heo
    2012-12-28 20:35   ` [PATCH 08/24] blkcg: reorganize blkg_lookup_create() and friends Tejun Heo
    2012-12-28 20:35   ` [PATCH 09/24] blkcg: cosmetic updates to blkg_create() Tejun Heo
    2012-12-28 20:35   ` [PATCH 10/24] blkcg: make blkcg_gq's hierarchical Tejun Heo
    2012-12-28 20:35   ` [PATCH 11/24] cfq-iosched: add leaf_weight Tejun Heo
    2012-12-28 20:35   ` [PATCH 12/24] cfq-iosched: implement cfq_group->nr_active and ->children_weight Tejun Heo
    2012-12-28 20:35   ` [PATCH 13/24] cfq-iosched: implement hierarchy-ready cfq_group charge scaling Tejun Heo
         [not found]     ` <1356726946-26037-14-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 16:16       ` Vivek Goyal
    2012-12-28 20:35   ` [PATCH 14/24] cfq-iosched: convert cfq_group_slice() to use cfqg->vfraction Tejun Heo
    2012-12-28 20:35   ` [PATCH 15/24] cfq-iosched: enable full blkcg hierarchy support Tejun Heo
    2012-12-28 20:35   ` [PATCH 16/24] blkcg: add blkg_policy_data->plid Tejun Heo
    2012-12-28 20:35   ` [PATCH 17/24] blkcg: implement blkcg_policy->on/offline_pd_fn() and blkcg_gq->online Tejun Heo
         [not found]     ` <20130102193828.GE4306@redhat.com>
         [not found]       ` <20130102193828.GE4306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-02 20:37         ` Tejun Heo
         [not found]     ` <1356726946-26037-18-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-02 19:38       ` Vivek Goyal
    2013-01-08 16:58       ` Vivek Goyal
    2012-12-28 20:35   ` [PATCH 18/24] blkcg: s/blkg_rwstat_sum()/blkg_rwstat_total()/ Tejun Heo
         [not found]     ` <1356726946-26037-19-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 16:59       ` Vivek Goyal
    2012-12-28 20:35   ` [PATCH 19/24] blkcg: implement blkg_[rw]stat_recursive_sum() and blkg_[rw]stat_merge() Tejun Heo
    2012-12-28 20:35   ` [PATCH 20/24] block: RCU free request_queue Tejun Heo
    2012-12-28 20:35   ` [PATCH 21/24] blkcg: make blkcg_print_blkgs() grab q locks instead of blkcg lock Tejun Heo
         [not found]     ` <1356726946-26037-22-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-02 19:27       ` Vivek Goyal
    2013-01-08 18:08       ` Vivek Goyal
         [not found]     ` <20130102192700.GA9552@redhat.com>
         [not found]       ` <20130102192700.GA9552-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-02 20:45         ` Tejun Heo
    2012-12-28 20:35   ` [PATCH 22/24] cfq-iosched: separate out cfqg_stats_reset() from cfq_pd_reset_stats() Tejun Heo
    2012-12-28 20:35   ` [PATCH 23/24] cfq-iosched: collect stats from dead cfqgs Tejun Heo
    2012-12-28 20:35   ` [PATCH 24/24] cfq-iosched: add hierarchical cfq_group statistics Tejun Heo
    2012-12-28 23:18   ` [PATCH 18.5/24] blkcg: export __blkg_prfill_rwstat() take#2 Tejun Heo
    2013-01-02 18:20   ` [PATCHSET] block: implement blkcg hierarchy support in cfq, take#2 Vivek Goyal
         [not found] ` <1356726946-26037-21-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-21-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-02 18:48     ` [PATCH 20/24] block: RCU free request_queue Vivek Goyal
         [not found]       ` <20130102184814.GD4306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-02 20:43         ` Tejun Heo
    2013-01-08 18:05     ` Vivek Goyal
         [not found] ` <1356726946-26037-16-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-16-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-07 16:34     ` [PATCH UPDATED 15/24] cfq-iosched: enable full blkcg hierarchy support Tejun Heo
         [not found]       ` <20130107163405.GE3926-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
    2013-01-08 14:42         ` Vivek Goyal
         [not found]           ` <20130108144240.GA29635-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-08 17:19             ` Tejun Heo
         [not found] ` <20130102182037.GC4306@redhat.com>
         [not found]   ` <20130102182037.GC4306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-07 16:34     ` [PATCHSET] block: implement blkcg hierarchy support in cfq, take#2 Tejun Heo
         [not found]   ` <20130107163437.GF3926@htj.dyndns.org>
         [not found]     ` <20130107163437.GF3926-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
    2013-01-08 18:28       ` Vivek Goyal
         [not found] ` <1356726946-26037-12-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-12-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 15:34     ` [PATCH 11/24] cfq-iosched: add leaf_weight Vivek Goyal
         [not found]       ` <20130108153448.GB29635-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-08 17:24         ` Tejun Heo
         [not found] ` <1356726946-26037-13-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-13-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 15:51     ` [PATCH 12/24] cfq-iosched: implement cfq_group->nr_active and ->children_weight Vivek Goyal
         [not found] ` <1356726946-26037-15-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-15-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 16:42     ` [PATCH 14/24] cfq-iosched: convert cfq_group_slice() to use cfqg->vfraction Vivek Goyal
         [not found] ` <1356726946-26037-17-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-17-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 16:51     ` [PATCH 16/24] blkcg: add blkg_policy_data->plid Vivek Goyal
         [not found] ` <1356726946-26037-20-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-20-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 18:03     ` [PATCH 19/24] blkcg: implement blkg_[rw]stat_recursive_sum() and blkg_[rw]stat_merge() Vivek Goyal
         [not found] ` <1356726946-26037-23-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-23-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 18:09     ` [PATCH 22/24] cfq-iosched: separate out cfqg_stats_reset() from cfq_pd_reset_stats() Vivek Goyal
         [not found] ` <1356726946-26037-24-git-send-email-tj@kernel.org>
         [not found]   ` <20130102162415.GA4306@redhat.com>
         [not found]     ` <20130102162415.GA4306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-02 16:30       ` [PATCH 23/24] cfq-iosched: collect stats from dead cfqgs Tejun Heo
         [not found]     ` <20130102163010.GC11220@mtj.dyndns.org>
         [not found]       ` <20130102163010.GC11220-9pTldWuhBndy/B6EtB590w@public.gmane.org>
    2013-01-02 16:44         ` Vivek Goyal
         [not found]           ` <20130102164415.GB4306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
    2013-01-02 16:52             ` Tejun Heo
         [not found]   ` <1356726946-26037-24-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-02 16:24     ` Vivek Goyal
    2013-01-08 18:12     ` Vivek Goyal
         [not found] ` <1356726946-26037-25-git-send-email-tj@kernel.org>
         [not found]   ` <1356726946-26037-25-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
    2013-01-08 18:27     ` [PATCH 24/24] cfq-iosched: add hierarchical cfq_group statistics Vivek Goyal
    2012-12-28 20:35 [PATCHSET] block: implement blkcg hierarchy support in cfq, take#2 Tejun Heo
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox