Skip to content
  • Tejun Heo's avatar
    cfq-iosched: add leaf_weight · e71357e1
    Tejun Heo authored
    
    
    cfq blkcg is about to grow proper hierarchy handling, where a child
    blkg's weight would nest inside the parent's.  This makes tasks in a
    blkg to compete against both tasks in the sibling blkgs and the tasks
    of child blkgs.
    
    We're gonna use the existing weight as the group weight which decides
    the blkg's weight against its siblings.  This patch introduces a new
    weight - leaf_weight - which decides the weight of a blkg against the
    child blkgs.
    
    It's named leaf_weight because another way to look at it is that each
    internal blkg nodes have a hidden child leaf node which contains all
    its tasks and leaf_weight is the weight of the leaf node and handled
    the same as the weight of the child blkgs.
    
    This patch only adds leaf_weight fields and exposes it to userland.
    The new weight isn't actually used anywhere yet.  Note that
    cfq-iosched currently offcially supports only single level hierarchy
    and root blkgs compete with the first level blkgs - ie. root weight is
    basically being used as leaf_weight.  For root blkgs, the two weights
    are kept in sync for backward compatibility.
    
    v2: cfqd->root_group->leaf_weight initialization was missing from
        cfq_init_queue() causing divide by zero when
        !CONFIG_CFQ_GROUP_SCHED.  Fix it.  Reported by Fengguang.
    
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Fengguang Wu <fengguang.wu@intel.com>
    e71357e1