Print this page
remove whole-process swapping
Long before Unix supported paging, it used process swapping to reclaim
memory. The code is there and in theory it runs when we get *extremely* low
on memory. In practice, it never runs since the definition of low-on-memory
is antiquated. (XXX: define what antiquated means)
You can check the number of swapout/swapin events with kstats:
$ kstat -p ::vm:swapin ::vm:swapout
@@ -153,13 +153,10 @@
kt_did_t t_did; /* thread id for kernel debuggers */
caddr_t t_tnf_tpdp; /* Trace facility data pointer */
struct _kcpc_ctx *t_cpc_ctx; /* performance counter context */
struct _kcpc_set *t_cpc_set; /* set this thread has bound */
- /*
- * non swappable part of the lwp state.
- */
id_t t_tid; /* lwp's id */
id_t t_waitfor; /* target lwp id in lwp_wait() */
struct sigqueue *t_sigqueue; /* queue of siginfo structs */
k_sigset_t t_sig; /* signals pending to this process */
k_sigset_t t_extsig; /* signals sent from another contract */
@@ -266,11 +263,10 @@
struct tsd_thread *ts_prev; /* threads with TSD */
uint_t ts_nkeys; /* entries in value array */
void **ts_value; /* array of value/key */
} *t_tsd;
- clock_t t_stime; /* time stamp used by the swapper */
struct door_data *t_door; /* door invocation data */
kmutex_t *t_plockp; /* pointer to process's p_lock */
struct sc_shared *t_schedctl; /* scheduler activations shared data */
uintptr_t t_sc_uaddr; /* user-level address of shared data */
@@ -397,14 +393,10 @@
/*
* Thread scheduler flag (t_schedflag) definitions.
* The thread must be locked via thread_lock() or equiv. to change these.
*/
-#define TS_LOAD 0x0001 /* thread is in memory */
-#define TS_DONT_SWAP 0x0002 /* thread/lwp should not be swapped */
-#define TS_SWAPENQ 0x0004 /* swap thread when it reaches a safe point */
-#define TS_ON_SWAPQ 0x0008 /* thread is on the swap queue */
#define TS_SIGNALLED 0x0010 /* thread was awakened by cv_signal() */
#define TS_PROJWAITQ 0x0020 /* thread is on its project's waitq */
#define TS_ZONEWAITQ 0x0040 /* thread is on its zone's waitq */
#define TS_CSTART 0x0100 /* setrun() by continuelwps() */
#define TS_UNPAUSE 0x0200 /* setrun() by unpauselwps() */
@@ -478,16 +470,10 @@
/* The assigned priority of a thread */
#define ASSIGNED_PRIO(t) ((t)->t_pri)
/*
- * Macros to determine whether a thread can be swapped.
- * If t_lock is held, the thread is either on a processor or being swapped.
- */
-#define SWAP_OK(t) (!LOCK_HELD(&(t)->t_lock))
-
-/*
* proctot(x)
* convert a proc pointer to a thread pointer. this only works with
* procs that have only one lwp.
*
* proctolwp(x)
@@ -651,16 +637,10 @@
* lock pointer provided. This lock should be held.
*/
#define THREAD_WAIT(tp, lp) THREAD_SET_STATE(tp, TS_WAIT, lp)
/*
- * Put thread in run state, and set the lock pointer to the dispatcher queue
- * lock pointer provided (i.e., the "swapped_lock"). This lock should be held.
- */
-#define THREAD_SWAP(tp, lp) THREAD_SET_STATE(tp, TS_RUN, lp)
-
-/*
* Put the thread in zombie state and set the lock pointer to NULL.
* The NULL will catch anything that tries to lock a zombie.
*/
#define THREAD_ZOMB(tp) THREAD_SET_STATE(tp, TS_ZOMB, NULL)