From ca2aedb2742acfe0e09c27eb608ccb5553dec03d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 25 Nov 2018 01:41:20 +0000 Subject: [PATCH] swap: fix case where we ended up self swapping when it's forbidden If the only other processes you have in memory are running, and you have gone to sleep thus triggering your swapout then we would try and swap out the running process, which isn't supported (because we avoid the cost of a swapper process we pay that small cost here). --- Kernel/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/swap.c b/Kernel/swap.c index 7e19b606..f12fe965 100644 --- a/Kernel/swap.c +++ b/Kernel/swap.c @@ -99,7 +99,7 @@ static ptptr swapvictim(ptptr p, int notself) c = getproc_nextp; do { - if (c->p_page) { /* No point swapping someone in swap! */ + if (c->p_page && c != udata.u_ptab) { /* No point swapping someone in swap! */ /* Find the last entry before us */ if (c->p_status == P_READY) r = c; -- 2.34.1