1. 18 Nov, 2010 8 commits
    • Paul Turner's avatar
      sched: Introduce hierarchal order on shares update list · 67e86250
      Paul Turner authored
      Avoid duplicate shares update calls by ensuring children always appear before
      parents in rq->leaf_cfs_rq_list.
      
      This allows us to do a single in-order traversal for update_shares().
      
      Since we always enqueue in bottom-up order this reduces to 2 cases:
      
      1) Our parent is already in the list, e.g.
      
         root
           \
            b
            /\
            c d* (root->b->c already enqueued)
      
      Since d's parent is enqueued we push it to the head of the list, implicitly ahead of b.
      
      2) Our parent does not appear in the list (or we have no parent)
      
      In this case we enqueue to the tail of the list, if our parent is subsequently enqueued
      (bottom-up) it will appear to our right by the same rule.
      Signed-off-by: default avatarPaul Turner <pjt@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20101115234938.022488865@google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      67e86250
    • Paul Turner's avatar
      sched: Fix update_cfs_load() synchronization · e33078ba
      Paul Turner authored
      Using cfs_rq->nr_running is not sufficient to synchronize update_cfs_load with
      the put path since nr_running accounting occurs at deactivation.
      
      It's also not safe to make the removal decision based on load_avg as this fails
      with both high periods and low shares.  Resolve this by clipping history after
      4 periods without activity.
      
      Note: the above will always occur from update_shares() since in the
      last-task-sleep-case that task will still be cfs_rq->curr when update_cfs_load
      is called.
      Signed-off-by: default avatarPaul Turner <pjt@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20101115234937.933428187@google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e33078ba
    • Paul Turner's avatar
      sched: Fix load corruption from update_cfs_shares() · f0d7442a
      Paul Turner authored
      As part of enqueue_entity both a new entity weight and its contribution to the
      queuing cfs_rq / rq are updated.  Since update_cfs_shares will only update the
      queueing weights when the entity is on_rq (which in this case it is not yet),
      there's a dependency loop here:
      
      update_cfs_shares needs account_entity_enqueue to update cfs_rq->load.weight
      account_entity_enqueue needs the updated weight for the queuing cfs_rq load[*]
      
      Fix this and avoid spurious dequeue/enqueues by issuing update_cfs_shares as
      if we had accounted the enqueue already.
      
      This was also resulting in rq->load corruption previously.
      
      [*]: this dependency also exists when using the group cfs_rq w/
           update_cfs_shares as the weight of the enqueued entity changes
           without the load being updated.
      Signed-off-by: default avatarPaul Turner <pjt@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20101115234937.844900206@google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f0d7442a
    • Peter Zijlstra's avatar
      sched: Make tg_shares_up() walk on-demand · 9e3081ca
      Peter Zijlstra authored
      Make tg_shares_up() use the active cgroup list, this means we cannot
      do a strict bottom-up walk of the hierarchy, but assuming its a very
      wide tree with a small number of active groups it should be a win.
      Signed-off-by: default avatarPaul Turner <pjt@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20101115234937.754159484@google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9e3081ca
    • Peter Zijlstra's avatar
      sched: Implement on-demand (active) cfs_rq list · 3d4b47b4
      Peter Zijlstra authored
      Make certain load-balance actions scale per number of active cgroups
      instead of the number of existing cgroups.
      
      This makes wakeup/sleep paths more expensive, but is a win for systems
      where the vast majority of existing cgroups are idle.
      Signed-off-by: default avatarPaul Turner <pjt@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20101115234937.666535048@google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3d4b47b4
    • Peter Zijlstra's avatar
      sched: Rewrite tg_shares_up) · 2069dd75
      Peter Zijlstra authored
      By tracking a per-cpu load-avg for each cfs_rq and folding it into a
      global task_group load on each tick we can rework tg_shares_up to be
      strictly per-cpu.
      
      This should improve cpu-cgroup performance for smp systems
      significantly.
      
      [ Paul: changed to use queueing cfs_rq + bug fixes ]
      Signed-off-by: default avatarPaul Turner <pjt@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20101115234937.580480400@google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2069dd75
    • Peter Zijlstra's avatar
      sched: Simplify cpu-hot-unplug task migration · 48c5ccae
      Peter Zijlstra authored
      While discussing the need for sched_idle_next(), Oleg remarked that
      since try_to_wake_up() ensures sleeping tasks will end up running on a
      sane cpu, we can do away with migrate_live_tasks().
      
      If we then extend the existing hack of migrating current from
      CPU_DYING to migrating the full rq worth of tasks from CPU_DYING, the
      need for the sched_idle_next() abomination disappears as well, since
      idle will be the only possible thread left after the migration thread
      stops.
      
      This greatly simplifies the hot-unplug task migration path, as can be
      seen from the resulting code reduction (and about half the new lines
      are comments).
      Suggested-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1289851597.2109.547.camel@laptop>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      48c5ccae
    • Ingo Molnar's avatar
      Merge commit 'v2.6.37-rc2' into sched/core · 92fd4d4d
      Ingo Molnar authored
      Merge reason: Move to a .37-rc base.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      92fd4d4d
  2. 16 Nov, 2010 1 commit
  3. 15 Nov, 2010 31 commits