cvs commit: src/sys/kern sched_4bsd.c

John Baldwin jhb at FreeBSD.org
Mon Jul 28 17:25:43 UTC 2008


jhb         2008-07-28 17:25:24 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             sched_4bsd.c 
  Log:
  SVN rev 180923 on 2008-07-28 17:25:24Z by jhb
  
  Implement support for cpusets in the 4BSD scheduler.
  - When a cpuset is applied to a thread, walk the cpuset to see if it is a
    "full" cpuset (includes all available CPUs).  If not, set a new
    TDS_AFFINITY flag to indicate that this thread can't run on all CPUs.
    When inheriting a cpuset from another thread during thread creation, the
    new thread also inherits this flag.  It is in a new ts_flags field in
    td_sched rather than using one of the TDF_SCHEDx flags because fork()
    clears td_flags after invoking sched_fork().
  - When placing a thread on a runqueue via sched_add(), if the thread is not
    pinned or bound but has the TDS_AFFINITY flag set, then invoke a new
    routine (sched_pickcpu()) to pick a CPU for the thread to run on next.
    sched_pickcpu() walks the cpuset and picks the CPU with the shortest
    per-CPU runqueue length.  Note that the reason for the TDS_AFFINITY flag
    is to avoid having to walk the cpuset and examine runq lengths in the
    common case.
  - To avoid walking the per-CPU runqueues in sched_pickcpu(), add an array
    of counters to hold the length of the per-CPU runqueues and update them
    when adding and removing threads to per-CPU runqueues.
  
  MFC after:      2 weeks
  
  Revision  Changes    Path
  1.128     +116 -0    src/sys/kern/sched_4bsd.c


More information about the cvs-all mailing list