swap: fix a nasty little bug
authorAlan Cox <alan@linux.intel.com>
Fri, 21 Sep 2018 22:41:09 +0000 (23:41 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 21 Sep 2018 22:41:09 +0000 (23:41 +0100)
We checked against the wrong process for one case, that in turn meant a specific
pattern of activity could mess up when it tried to swap out a zombie process

Kernel/swap.c

index c2c269c..7e19b60 100644 (file)
@@ -104,7 +104,7 @@ static ptptr swapvictim(ptptr p, int notself)
                        if (c->p_status == P_READY)
                                r = c;
                        if (c->p_status > P_READY
-                           && p->p_status <= P_FORKING) {
+                           && c->p_status <= P_FORKING) {
                                /* relative position in order of waits, bigger is longer, can wrap but
                                   shouldn't really matter to us much if it does */
                                s = (waitno - c->p_waitno);