Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108672903
D46113.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D46113.diff
View Options
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -256,7 +256,6 @@
void
mi_startup(void)
{
-
struct sysinit *sip;
int last;
#if defined(VERBOSE_SYSINIT)
@@ -339,10 +338,12 @@
mtx_unlock(&Giant);
/*
- * Now hand over this thread to swapper.
+ * We can't free our thread structure since it is statically allocated.
+ * Just sleep forever. This thread could be repurposed for something if
+ * the need arises.
*/
- swapper();
- /* NOTREACHED*/
+ for (;;)
+ tsleep(__builtin_frame_address(0), PNOLOCK, "parked", 0);
}
static void
diff --git a/sys/vm/vm.h b/sys/vm/vm.h
--- a/sys/vm/vm.h
+++ b/sys/vm/vm.h
@@ -170,7 +170,6 @@
void swap_reserve_force(vm_ooffset_t incr);
void swap_release(vm_ooffset_t decr);
void swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred);
-void swapper(void);
extern struct kva_md_info kmi;
#define VA_IS_CLEANMAP(va) \
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -834,9 +834,10 @@
vmspace_exitfree(p); /* and clean-out the vmspace */
}
+/*
+ * This used to kick the thread which faults in threads.
+ */
void
kick_proc0(void)
{
-
- wakeup(&proc0);
}
diff --git a/sys/vm/vm_swapout.c b/sys/vm/vm_swapout.c
--- a/sys/vm/vm_swapout.c
+++ b/sys/vm/vm_swapout.c
@@ -564,126 +564,6 @@
}
}
-/*
- * This swapin algorithm attempts to swap-in processes only if there
- * is enough space for them. Of course, if a process waits for a long
- * time, it will be swapped in anyway.
- */
-
-static struct proc *
-swapper_selector(bool wkilled_only)
-{
- struct proc *p, *res;
- struct thread *td;
- int ppri, pri, slptime, swtime;
-
- sx_assert(&allproc_lock, SA_SLOCKED);
- if (swapped_cnt == 0)
- return (NULL);
- res = NULL;
- ppri = INT_MIN;
- FOREACH_PROC_IN_SYSTEM(p) {
- PROC_LOCK(p);
- if (p->p_state == PRS_NEW || (p->p_flag & (P_SWAPPINGOUT |
- P_SWAPPINGIN | P_INMEM)) != 0) {
- PROC_UNLOCK(p);
- continue;
- }
- if (p->p_state == PRS_NORMAL && (p->p_flag & P_WKILLED) != 0) {
- /*
- * A swapped-out process might have mapped a
- * large portion of the system's pages as
- * anonymous memory. There is no other way to
- * release the memory other than to kill the
- * process, for which we need to swap it in.
- */
- return (p);
- }
- if (wkilled_only) {
- PROC_UNLOCK(p);
- continue;
- }
- swtime = (ticks - p->p_swtick) / hz;
- FOREACH_THREAD_IN_PROC(p, td) {
- /*
- * An otherwise runnable thread of a process
- * swapped out has only the TDI_SWAPPED bit set.
- */
- thread_lock(td);
- if (td->td_inhibitors == TDI_SWAPPED) {
- slptime = (ticks - td->td_slptick) / hz;
- pri = swtime + slptime;
- if ((td->td_flags & TDF_SWAPINREQ) == 0)
- pri -= p->p_nice * 8;
- /*
- * if this thread is higher priority
- * and there is enough space, then select
- * this process instead of the previous
- * selection.
- */
- if (pri > ppri) {
- res = p;
- ppri = pri;
- }
- }
- thread_unlock(td);
- }
- PROC_UNLOCK(p);
- }
-
- if (res != NULL)
- PROC_LOCK(res);
- return (res);
-}
-
-#define SWAPIN_INTERVAL (MAXSLP * hz / 2)
-
-/*
- * Limit swapper to swap in one non-WKILLED process in MAXSLP/2
- * interval, assuming that there is:
- * - at least one domain that is not suffering from a shortage of free memory;
- * - no parallel swap-ins;
- * - no other swap-ins in the current SWAPIN_INTERVAL.
- */
-static bool
-swapper_wkilled_only(void)
-{
-
- return (vm_page_count_min_set(&all_domains) || swap_inprogress > 0 ||
- (u_int)(ticks - last_swapin) < SWAPIN_INTERVAL);
-}
-
-void
-swapper(void)
-{
- struct proc *p;
-
- for (;;) {
- sx_slock(&allproc_lock);
- p = swapper_selector(swapper_wkilled_only());
- sx_sunlock(&allproc_lock);
-
- if (p == NULL) {
- tsleep(&proc0, PVM, "swapin", SWAPIN_INTERVAL);
- } else {
- PROC_LOCK_ASSERT(p, MA_OWNED);
-
- /*
- * Another process may be bringing or may have
- * already brought this process in while we
- * traverse all threads. Or, this process may
- * have exited or even being swapped out
- * again.
- */
- if (p->p_state == PRS_NORMAL && (p->p_flag & (P_INMEM |
- P_SWAPPINGOUT | P_SWAPPINGIN)) == 0) {
- faultin(p);
- }
- PROC_UNLOCK(p);
- }
- }
-}
-
static void
swapclear(struct proc *p)
{
diff --git a/sys/vm/vm_swapout_dummy.c b/sys/vm/vm_swapout_dummy.c
--- a/sys/vm/vm_swapout_dummy.c
+++ b/sys/vm/vm_swapout_dummy.c
@@ -99,11 +99,3 @@
if ((p->p_flag & P_INMEM) == 0)
panic("faultin: proc %p swapped out with NO_SWAPPING", p);
}
-
-void
-swapper(void)
-{
-
- for (;;)
- tsleep(&proc0, PVM, "swapin", MAXSLP * hz);
-}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 28, 5:29 AM (10 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16252227
Default Alt Text
D46113.diff (4 KB)
Attached To
Mode
D46113: vm: Remove kernel stack swapping support, part 2
Attached
Detach File
Event Timeline
Log In to Comment