swap: fix case where we ended up self swapping when it's forbidden
authorAlan Cox <alan@linux.intel.com>
Sun, 25 Nov 2018 01:41:20 +0000 (01:41 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 25 Nov 2018 01:41:20 +0000 (01:41 +0000)
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

index 7e19b60..f12fe96 100644 (file)
@@ -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;