1. 09 3月, 2006 1 次提交
  2. 07 3月, 2006 1 次提交
    • L
      Add early-boot-safety check to cond_resched() · 8ba7b0a1
      Linus Torvalds 提交于
      Just to be safe, we should not trigger a conditional reschedule during
      the early boot sequence.  We've historically done some questionable
      early on, and the safety warnings in __might_sleep() are generally
      turned off during that period, so there might be problems lurking.
      
      This affects CONFIG_PREEMPT_VOLUNTARY, which takes over might_sleep() to
      cause a voluntary conditional reschedule.
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      8ba7b0a1
  3. 18 2月, 2006 1 次提交
    • I
      [PATCH] Introduce CONFIG_DEFAULT_MIGRATION_COST · 4bbf39c2
      Ingo Molnar 提交于
      Heiko Carstens <heiko.carstens@de.ibm.com> wrote:
      
        The boot sequence on s390 sometimes takes ages and we spend a very long
        time (up to one or two minutes) in calibrate_migration_costs.  The time
        spent there differs from boot to boot.  Also the calculated costs differ
        a lot.  I've seen differences by up to a factor of 15 (yes, factor not
        percent).  Also I doubt that making these measurements make much sense on
        a completely virtualized architecture where you cannot tell how much cpu
        time you will get anyway.
      
      So introduce the CONFIG_DEFAULT_MIGRATION_COST method for an architecture
      to set the scheduler migration costs.  This turns off automatic detection
      of migration costs.  Makes sense on virtual platforms, where migration
      costs are hard to measure accurately.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4bbf39c2
  4. 15 2月, 2006 1 次提交
    • C
      [PATCH] sched: revert "filter affine wakeups" · d6077cb8
      Chen, Kenneth W 提交于
      Revert commit d7102e95:
      
          [PATCH] sched: filter affine wakeups
      
      Apparently caused more than 10% performance regression for aim7 benchmark.
      The setup in use is 16-cpu HP rx8620, 64Gb of memory and 12 MSA1000s with 144
      disks.  Each disk is 72Gb with a single ext3 filesystem (courtesy of HP, who
      supplied benchmark results).
      
      The problem is, for aim7, the wake-up pattern is random, but it still needs
      load balancing action in the wake-up path to achieve best performance.  With
      the above commit, lack of load balancing hurts that workload.
      
      However, for workloads like database transaction processing, the requirement
      is exactly opposite.  In the wake up path, best performance is achieved with
      absolutely zero load balancing.  We simply wake up the process on the CPU that
      it was previously run.  Worst performance is obtained when we do load
      balancing at wake up.
      
      There isn't an easy way to auto detect the workload characteristics.  Ingo's
      earlier patch that detects idle CPU and decide whether to load balance or not
      doesn't perform with aim7 either since all CPUs are busy (it causes even
      bigger perf.  regression).
      
      Revert commit d7102e95, which causes more
      than 10% performance regression with aim7.
      Signed-off-by: NKen Chen <kenneth.w.chen@intel.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d6077cb8
  5. 11 2月, 2006 1 次提交
    • N
      [PATCH] sched: remove smpnice · a2000572
      Nick Piggin 提交于
      I don't think the code is quite ready, which is why I asked for Peter's
      additions to also be merged before I acked it (although it turned out that
      it still isn't quite ready with his additions either).
      
      Basically I have had similar observations to Suresh in that it does not
      play nicely with the rest of the balancing infrastructure (and raised
      similar concerns in my review).
      
      The samples (group of 4) I got for "maximum recorded imbalance" on a 2x2
      SMP+HT Xeon are as follows:
      
                  | Following boot | hackbench 20        | hackbench 40
       -----------+----------------+---------------------+---------------------
       2.6.16-rc2 | 30,37,100,112  | 5600,5530,6020,6090 | 6390,7090,8760,8470
       +nosmpnice |  3, 2,  4,  2  |   28, 150, 294, 132 |  348, 348, 294, 347
      
      Hackbench raw performance is down around 15% with smpnice (but that in
      itself isn't a huge deal because it is just a benchmark).  However, the
      samples show that the imbalance passed into move_tasks is increased by
      about a factor of 10-30.  I think this would also go some way to explaining
      latency blips turning up in the balancing code (though I haven't actually
      measured that).
      
      We'll probably have to revert this in the SUSE kernel.
      
      Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Cc: Peter Williams <pwil3058@bigpond.net.au>
      Cc: "Martin J. Bligh" <mbligh@aracnet.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a2000572
  6. 06 2月, 2006 2 次提交
  7. 02 2月, 2006 1 次提交
    • J
      [PATCH] sys_sched_getaffinity() & hotplug · 2f7016d9
      Jack Steiner 提交于
      Change sched_getaffinity() so that it returns a bitmap that indicates the
      legally schedulable cpus that a task is allowed to run on.
      
      Without this patch, if CONFIG_HOTPLUG_CPU is enabled, sched_getaffinity()
      unconditionally returns (at least on IA64) a mask with NR_CPUS bits set.
      This conveys no useful infornmation except for a kernel compile option.
      
      This fixes a breakage we obseved running recent kernels. We have MPI jobs
      that use sched_getaffinity() to determine where to place their threads.
      Placing them on non-existant cpus is problematic :-)
      Signed-off-by: NJack Steiner <steiner@sgi.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Cc: Nathan Lynch <ntl@pobox.com>
      Cc: Paul Jackson <pj@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      2f7016d9
  8. 01 2月, 2006 1 次提交
  9. 19 1月, 2006 1 次提交
  10. 15 1月, 2006 2 次提交
  11. 13 1月, 2006 2 次提交
    • A
      [PATCH] sched: filter affine wakeups · d7102e95
      akpm@osdl.org 提交于
      )
      
      From: Nick Piggin <nickpiggin@yahoo.com.au>
      
      Track the last waker CPU, and only consider wakeup-balancing if there's a
      match between current waker CPU and the previous waker CPU.  This ensures
      that there is some correlation between two subsequent wakeup events before
      we move the task.  Should help random-wakeup workloads on large SMP
      systems, by reducing the migration attempts by a factor of nr_cpus.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d7102e95
    • A
      [PATCH] scheduler cache-hot-autodetect · 198e2f18
      akpm@osdl.org 提交于
      )
      
      From: Ingo Molnar <mingo@elte.hu>
      
      This is the latest version of the scheduler cache-hot-auto-tune patch.
      
      The first problem was that detection time scaled with O(N^2), which is
      unacceptable on larger SMP and NUMA systems. To solve this:
      
      - I've added a 'domain distance' function, which is used to cache
        measurement results. Each distance is only measured once. This means
        that e.g. on NUMA distances of 0, 1 and 2 might be measured, on HT
        distances 0 and 1, and on SMP distance 0 is measured. The code walks
        the domain tree to determine the distance, so it automatically follows
        whatever hierarchy an architecture sets up. This cuts down on the boot
        time significantly and removes the O(N^2) limit. The only assumption
        is that migration costs can be expressed as a function of domain
        distance - this covers the overwhelming majority of existing systems,
        and is a good guess even for more assymetric systems.
      
        [ People hacking systems that have assymetries that break this
          assumption (e.g. different CPU speeds) should experiment a bit with
          the cpu_distance() function. Adding a ->migration_distance factor to
          the domain structure would be one possible solution - but lets first
          see the problem systems, if they exist at all. Lets not overdesign. ]
      
      Another problem was that only a single cache-size was used for measuring
      the cost of migration, and most architectures didnt set that variable
      up. Furthermore, a single cache-size does not fit NUMA hierarchies with
      L3 caches and does not fit HT setups, where different CPUs will often
      have different 'effective cache sizes'. To solve this problem:
      
      - Instead of relying on a single cache-size provided by the platform and
        sticking to it, the code now auto-detects the 'effective migration
        cost' between two measured CPUs, via iterating through a wide range of
        cachesizes. The code searches for the maximum migration cost, which
        occurs when the working set of the test-workload falls just below the
        'effective cache size'. I.e. real-life optimized search is done for
        the maximum migration cost, between two real CPUs.
      
        This, amongst other things, has the positive effect hat if e.g. two
        CPUs share a L2/L3 cache, a different (and accurate) migration cost
        will be found than between two CPUs on the same system that dont share
        any caches.
      
      (The reliable measurement of migration costs is tricky - see the source
      for details.)
      
      Furthermore i've added various boot-time options to override/tune
      migration behavior.
      
      Firstly, there's a blanket override for autodetection:
      
      	migration_cost=1000,2000,3000
      
      will override the depth 0/1/2 values with 1msec/2msec/3msec values.
      
      Secondly, there's a global factor that can be used to increase (or
      decrease) the autodetected values:
      
      	migration_factor=120
      
      will increase the autodetected values by 20%. This option is useful to
      tune things in a workload-dependent way - e.g. if a workload is
      cache-insensitive then CPU utilization can be maximized by specifying
      migration_factor=0.
      
      I've tested the autodetection code quite extensively on x86, on 3
      P3/Xeon/2MB, and the autodetected values look pretty good:
      
      Dual Celeron (128K L2 cache):
      
       ---------------------
       migration cost matrix (max_cache_size: 131072, cpu: 467 MHz):
       ---------------------
                 [00]    [01]
       [00]:     -     1.7(1)
       [01]:   1.7(1)    -
       ---------------------
       cacheflush times [2]: 0.0 (0) 1.7 (1784008)
       ---------------------
      
      Here the slow memory subsystem dominates system performance, and even
      though caches are small, the migration cost is 1.7 msecs.
      
      Dual HT P4 (512K L2 cache):
      
       ---------------------
       migration cost matrix (max_cache_size: 524288, cpu: 2379 MHz):
       ---------------------
                 [00]    [01]    [02]    [03]
       [00]:     -     0.4(1)  0.0(0)  0.4(1)
       [01]:   0.4(1)    -     0.4(1)  0.0(0)
       [02]:   0.0(0)  0.4(1)    -     0.4(1)
       [03]:   0.4(1)  0.0(0)  0.4(1)    -
       ---------------------
       cacheflush times [2]: 0.0 (33900) 0.4 (448514)
       ---------------------
      
      Here it can be seen that there is no migration cost between two HT
      siblings (CPU#0/2 and CPU#1/3 are separate physical CPUs). A fast memory
      system makes inter-physical-CPU migration pretty cheap: 0.4 msecs.
      
      8-way P3/Xeon [2MB L2 cache]:
      
       ---------------------
       migration cost matrix (max_cache_size: 2097152, cpu: 700 MHz):
       ---------------------
                 [00]    [01]    [02]    [03]    [04]    [05]    [06]    [07]
       [00]:     -    19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1)
       [01]:  19.2(1)    -    19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1)
       [02]:  19.2(1) 19.2(1)    -    19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1)
       [03]:  19.2(1) 19.2(1) 19.2(1)    -    19.2(1) 19.2(1) 19.2(1) 19.2(1)
       [04]:  19.2(1) 19.2(1) 19.2(1) 19.2(1)    -    19.2(1) 19.2(1) 19.2(1)
       [05]:  19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1)    -    19.2(1) 19.2(1)
       [06]:  19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1)    -    19.2(1)
       [07]:  19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1) 19.2(1)    -
       ---------------------
       cacheflush times [2]: 0.0 (0) 19.2 (19281756)
       ---------------------
      
      This one has huge caches and a relatively slow memory subsystem - so the
      migration cost is 19 msecs.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAshok Raj <ashok.raj@intel.com>
      Signed-off-by: NKen Chen <kenneth.w.chen@intel.com>
      Cc: <wilder@us.ibm.com>
      Signed-off-by: NJohn Hawkes <hawkes@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      198e2f18
  12. 12 1月, 2006 2 次提交
  13. 10 1月, 2006 1 次提交
  14. 09 1月, 2006 1 次提交
  15. 14 11月, 2005 2 次提交
  16. 10 11月, 2005 1 次提交
  17. 09 11月, 2005 7 次提交
    • N
      [PATCH] sched: resched and cpu_idle rework · 64c7c8f8
      Nick Piggin 提交于
      Make some changes to the NEED_RESCHED and POLLING_NRFLAG to reduce
      confusion, and make their semantics rigid.  Improves efficiency of
      resched_task and some cpu_idle routines.
      
      * In resched_task:
      - TIF_NEED_RESCHED is only cleared with the task's runqueue lock held,
        and as we hold it during resched_task, then there is no need for an
        atomic test and set there. The only other time this should be set is
        when the task's quantum expires, in the timer interrupt - this is
        protected against because the rq lock is irq-safe.
      
      - If TIF_NEED_RESCHED is set, then we don't need to do anything. It
        won't get unset until the task get's schedule()d off.
      
      - If we are running on the same CPU as the task we resched, then set
        TIF_NEED_RESCHED and no further action is required.
      
      - If we are running on another CPU, and TIF_POLLING_NRFLAG is *not* set
        after TIF_NEED_RESCHED has been set, then we need to send an IPI.
      
      Using these rules, we are able to remove the test and set operation in
      resched_task, and make clear the previously vague semantics of
      POLLING_NRFLAG.
      
      * In idle routines:
      - Enter cpu_idle with preempt disabled. When the need_resched() condition
        becomes true, explicitly call schedule(). This makes things a bit clearer
        (IMO), but haven't updated all architectures yet.
      
      - Many do a test and clear of TIF_NEED_RESCHED for some reason. According
        to the resched_task rules, this isn't needed (and actually breaks the
        assumption that TIF_NEED_RESCHED is only cleared with the runqueue lock
        held). So remove that. Generally one less locked memory op when switching
        to the idle thread.
      
      - Many idle routines clear TIF_POLLING_NRFLAG, and only set it in the inner
        most polling idle loops. The above resched_task semantics allow it to be
        set until before the last time need_resched() is checked before going into
        a halt requiring interrupt wakeup.
      
        Many idle routines simply never enter such a halt, and so POLLING_NRFLAG
        can be always left set, completely eliminating resched IPIs when rescheduling
        the idle task.
      
        POLLING_NRFLAG width can be increased, to reduce the chance of resched IPIs.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Con Kolivas <kernel@kolivas.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      64c7c8f8
    • C
      [PATCH] sched: consider migration thread with smp nice · ede3d0fb
      Con Kolivas 提交于
      The intermittent scheduling of the migration thread at ultra high priority
      makes the smp nice handling see that runqueue as being heavily loaded.  The
      migration thread itself actually handles the balancing so its influence on
      priority balancing should be ignored.
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      ede3d0fb
    • C
      [PATCH] sched: correct smp_nice_bias · 6dd4a85b
      Con Kolivas 提交于
      The priority biasing was off by mutliplying the total load by the total
      priority bias and this ruins the ratio of loads between runqueues. This
      patch should correct the ratios of loads between runqueues to be proportional
      to overall load. -2nd attempt.
      
      From: Dave Kleikamp <shaggy@austin.ibm.com>
      
        This patch fixes a divide-by-zero error that I hit on a two-way i386
        machine.  rq->nr_running is tested to be non-zero, but may change by the
        time it is used in the division.  Saving the value to a local variable
        ensures that the same value that is checked is used in the division.
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Signed-off-by: NDave Kleikamp <shaggy@austin.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6dd4a85b
    • C
      [PATCH] sched: smp nice bias busy queues on idle rebalance · 3b0bd9bc
      Con Kolivas 提交于
      To intensify the 'nice' support across physical cpus on SMP we can bias the
      loads on idle rebalancing. To prevent idle rebalance from trying to pull tasks
      from queues that appear heavily loaded we only bias the load if there is more
      than one task running.
      
      Add some minor micro-optimisations and have only one return from __source_load
      and __target_load functions.
      
      Fix the fact that target_load was not biased by priority when type == 0.
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      3b0bd9bc
    • C
      [PATCH] sched: account rt tasks in prio_bias() · dad1c65c
      Con Kolivas 提交于
      Real time tasks' effect on prio_bias should be based on their real time
      priority level instead of their static_prio which is based on nice.
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      dad1c65c
    • C
      [PATCH] sched: change prio bias only if queued · 738a2ccb
      Con Kolivas 提交于
      prio_bias should only be adjusted in set_user_nice if p is actually currently
      queued.
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      738a2ccb
    • C
      [PATCH] sched: implement nice support across physical cpus on SMP · b910472d
      Con Kolivas 提交于
      This patch implements 'nice' support across physical cpus on SMP.
      
      It introduces an extra runqueue variable prio_bias which is the sum of the
      (inverted) static priorities of all the tasks on the runqueue.
      
      This is then used to bias busy rebalancing between runqueues to obtain good
      distribution of tasks of different nice values.  By biasing the balancing only
      during busy rebalancing we can avoid having any significant loss of throughput
      by not affecting the carefully tuned idle balancing already in place.  If all
      tasks are running at the same nice level this code should also have minimal
      effect.  The code is optimised out in the !CONFIG_SMP case.
      Signed-off-by: NCon Kolivas <kernel@kolivas.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Nick Piggin <nickpiggin@yahoo.com.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      b910472d
  18. 07 11月, 2005 2 次提交
  19. 05 11月, 2005 1 次提交
  20. 31 10月, 2005 1 次提交
  21. 30 10月, 2005 1 次提交
    • H
      [PATCH] mm: update_hiwaters just in time · 365e9c87
      Hugh Dickins 提交于
      update_mem_hiwater has attracted various criticisms, in particular from those
      concerned with mm scalability.  Originally it was called whenever rss or
      total_vm got raised.  Then many of those callsites were replaced by a timer
      tick call from account_system_time.  Now Frank van Maarseveen reports that to
      be found inadequate.  How about this?  Works for Frank.
      
      Replace update_mem_hiwater, a poor combination of two unrelated ops, by macros
      update_hiwater_rss and update_hiwater_vm.  Don't attempt to keep
      mm->hiwater_rss up to date at timer tick, nor every time we raise rss (usually
      by 1): those are hot paths.  Do the opposite, update only when about to lower
      rss (usually by many), or just before final accounting in do_exit.  Handle
      mm->hiwater_vm in the same way, though it's much less of an issue.  Demand
      that whoever collects these hiwater statistics do the work of taking the
      maximum with rss or total_vm.
      
      And there has been no collector of these hiwater statistics in the tree.  The
      new convention needs an example, so match Frank's usage by adding a VmPeak
      line above VmSize to /proc/<pid>/status, and also a VmHWM line above VmRSS
      (High-Water-Mark or High-Water-Memory).
      
      There was a particular anomaly during mremap move, that hiwater_vm might be
      captured too high.  A fleeting such anomaly remains, but it's quickly
      corrected now, whereas before it would stick.
      
      What locking?  None: if the app is racy then these statistics will be racy,
      it's not worth any overhead to make them exact.  But whenever it suits,
      hiwater_vm is updated under exclusive mmap_sem, and hiwater_rss under
      page_table_lock (for now) or with preemption disabled (later on): without
      going to any trouble, minimize the time between reading current values and
      updating, to minimize those occasions when a racing thread bumps a count up
      and back down in between.
      Signed-off-by: NHugh Dickins <hugh@veritas.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      365e9c87
  22. 27 10月, 2005 1 次提交
  23. 14 9月, 2005 1 次提交
  24. 12 9月, 2005 2 次提交
  25. 11 9月, 2005 3 次提交