Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/sys_pset.c
RevisionDateAuthorComments
 1.24  23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.23  21-Feb-2020  joerg Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.
 1.22  21-Nov-2019  ad branches: 1.22.2;
Simplify pset locking, making it easier to sync with LWP creation, etc.
 1.21  09-Dec-2018  mlelstv Handle the case when a CPU is assigned to a set it is already a member of.
Previously this would trigger an assertion failure.
 1.20  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.19  30-Jul-2015  maxv branches: 1.19.16; 1.19.18;
Don't forget to unlock the LWP.

ok rmind@
 1.18  25-Feb-2014  pooka branches: 1.18.4; 1.18.6;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.17  07-Aug-2011  rmind branches: 1.17.2; 1.17.8; 1.17.12; 1.17.16;
Remove LW_AFFINITY flag and fix some bugs affinity mask handling.
 1.16  07-Aug-2011  rmind Add kcpuset(9) - a reworked dynamic CPU set implementation for kernel.
Suitable for use during the early boot. MD and other implementations
should be replaced with this interface.

Discussed on: tech-kern@
 1.15  01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.14  25-Apr-2010  ad MAXCPUS -> maxcpus
 1.13  02-Oct-2009  elad branches: 1.13.2; 1.13.4;
Move psets security policy back to the subsystem and keep suser logic only
in the suser secmodel code.
 1.12  03-Mar-2009  rmind lwp_create: fix the locking bugs on affinity ingerition path (mea culpa).
pset_assign: traverse the list of LWPs safely.
sched_setaffinity: free cpuset (unused path) outside the lock.

Reviewed (with feedback) by <ad>.
 1.11  23-Jan-2009  rmind branches: 1.11.2;
sys__pset_bind: obviously, sched_takecpu() should take "t" LWP, not "l".
 1.10  20-Jan-2009  rmind - Make thread-affinity and processor-set interfaces mutually exlusive.
- pset_assign: when CPU is assigned, migrate out all LWPs from it.
 1.9  30-Sep-2008  rmind branches: 1.9.2; 1.9.4;
- Schedule bound threads even if CPU is offline. Might be revisited later,
when decision what to do with already bound threads will be made.
- Do not allow to assign offline CPU to the processor-set.

Quick fix for PR/39349.
 1.8  22-Jun-2008  ad branches: 1.8.2;
- Ensure that at least one cpu stays in the default pset, otherwise the
system will lock up.
- Use cpu_lock, there's no need for a seperate psets_lock.
- Add a sysctl to return the list of psets as a string.
 1.7  26-May-2008  rmind branches: 1.7.2;
Adjust and thus unify my license.
 1.6  24-Apr-2008  ad branches: 1.6.2; 1.6.4;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.5  24-Apr-2008  ad Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.4  30-Jan-2008  elad branches: 1.4.2; 1.4.8; 1.4.10; 1.4.12;
Use proper kauth(9) actions/requests for native scheduler stuff and the
recently introduced processor-sets.

Discussed with and okay rmind@, yamt@, and christos@.
 1.3  24-Jan-2008  rmind Fix the return values to conform the standard and/or be compatible with
other systems. Reported by <drochner>.
 1.2  15-Jan-2008  yamt branches: 1.2.2; 1.2.4;
sys__pset_bind: don't leave pset busy.
 1.1  15-Jan-2008  rmind Implementation of processor-sets, affinity and POSIX real-time extensions.
Add schedctl(8) - a program to control scheduling of processes and threads.

Notes:
- This is supported only by SCHED_M2;
- Migration of LWP mechanism will be revisited;

Proposed on: <tech-kern>. Reviewed by: <ad>.
 1.2.4.3  04-Feb-2008  yamt sync with head.
 1.2.4.2  21-Jan-2008  yamt sync with head
 1.2.4.1  15-Jan-2008  yamt file sys_pset.c was added on branch yamt-lazymbuf on 2008-01-21 09:46:25 +0000
 1.2.2.2  19-Jan-2008  bouyer Sync with HEAD
 1.2.2.1  15-Jan-2008  bouyer file sys_pset.c was added on branch bouyer-xeni386 on 2008-01-19 12:15:25 +0000
 1.4.12.2  04-Jun-2008  yamt sync with head
 1.4.12.1  18-May-2008  yamt sync with head.
 1.4.10.2  23-Mar-2008  matt sync with HEAD
 1.4.10.1  30-Jan-2008  matt file sys_pset.c was added on branch matt-armv6 on 2008-03-23 02:05:00 +0000
 1.4.8.3  05-Oct-2008  mjf Sync with HEAD.
 1.4.8.2  29-Jun-2008  mjf Sync with HEAD.
 1.4.8.1  02-Jun-2008  mjf Sync with HEAD.
 1.4.2.2  18-Feb-2008  mjf Sync with HEAD.
 1.4.2.1  30-Jan-2008  mjf file sys_pset.c was added on branch mjf-devfs on 2008-02-18 21:06:47 +0000
 1.6.4.2  10-Oct-2008  skrll Sync with HEAD.
 1.6.4.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.2.3  11-Aug-2010  yamt sync with head.
 1.6.2.2  11-Mar-2010  yamt sync with head
 1.6.2.1  04-May-2009  yamt sync with head.
 1.7.2.1  27-Jun-2008  simonb Sync with head.
 1.8.2.1  19-Oct-2008  haad Sync with HEAD.
 1.9.4.3  08-Mar-2009  snj Pull up following revision(s) (requested by rmind in ticket #546):
sys/kern/kern_lwp.c: revision 1.128
sys/kern/sys_pset.c: revision 1.12
sys/kern/sys_sched.c: revision 1.33
lwp_create: fix the locking bugs on affinity ingerition path (mea culpa).
pset_assign: traverse the list of LWPs safely.
sched_setaffinity: free cpuset (unused path) outside the lock.
Reviewed (with feedback) by <ad>.
 1.9.4.2  26-Jan-2009  snj Pull up following revision(s) (requested by rmind in ticket #312):
sys/kern/sys_pset.c: revision 1.11
sys__pset_bind: obviously, sched_takecpu() should take "t" LWP, not "l".
 1.9.4.1  22-Jan-2009  snj Pull up following revision(s) (requested by rmind in ticket #291):
lib/libpthread/affinity.3: revision 1.4
lib/librt/pset.3: revision 1.8
sys/kern/sys_pset.c: revision 1.10
sys/kern/sys_sched.c: revision 1.32
- Make thread-affinity and processor-set interfaces mutually exlusive.
- pset_assign: when CPU is assigned, migrate out all LWPs from it.
 1.9.2.2  28-Apr-2009  skrll Sync with HEAD.
 1.9.2.1  03-Mar-2009  skrll Sync with HEAD.
 1.11.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.4.2  03-Jul-2010  rmind sync with head
 1.13.4.1  30-May-2010  rmind sync with head
 1.13.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.13.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.17.16.1  18-May-2014  rmind sync with head
 1.17.12.2  03-Dec-2017  jdolecek update from HEAD
 1.17.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.8.1  15-Nov-2015  bouyer Pull up following revision(s) (requested by oster in ticket #1320):
sys/kern/sys_pset.c: revision 1.19
Don't forget to unlock the LWP.
ok rmind@
 1.17.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.6.1  22-Sep-2015  skrll Sync with HEAD
 1.18.4.1  06-Aug-2015  snj Pull up following revision(s) (requested by maxv in ticket #912):
sys/kern/sys_pset.c: revision 1.19
Don't forget to unlock the LWP.
ok rmind@
 1.19.18.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.19.18.1  10-Jun-2019  christos Sync with HEAD
 1.19.16.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.19.16.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.22.2.1  29-Feb-2020  ad Sync with head.

RSS XML Feed