Re: Swap signature eaten by 2.1.105

Andrea Arcangeli (arcangeli@mbox.queen.it)
Tue, 16 Jun 1998 02:35:57 +0200 (CEST)


On Mon, 15 Jun 1998, Andrea Arcangeli wrote:

>On Mon, 15 Jun 1998, Tim Waugh wrote:
>
>>After netscape had used up about all of my swap space, my Pentium with
>>32Mb went silent. The disks would make noises for under a second, about
>>every 20 seconds or so.
>
>Try to swapoff your two swap partition, when netscape has not yet loaded
>all your swap space and will see another deadlock (or more simply try to
>run without swap).

The problem was that swapoff was trying to swapin and kswapd was trying to
swapout and this caused deadlock.

This patch seems to fix the problem pretty well. With the patch applyed
swapoff die if there is not enough phisical memory to free all the swap.

There are still other cases where kswapd load the kernel and so made it
totally unusable if there is not more memory. For example if there is no
swap at all it' s a nosense that kswapd has to load my CPU at 100% and
force me to reset.

The vmscan is a cosmetic patch or course ;-).

--- linux/mm/vmscan.c 1998/06/15 23:32:58 1.1
+++ linux/mm/vmscan.c 1998/06/15 23:40:23
@@ -584,6 +584,7 @@
}
/* As if we could ever get here - maybe we want to make this killable */
remove_wait_queue(&kswapd_wait, &wait);
+ unlock_kernel();
return 0;
}

--- linux/mm/swapfile.c 1998/06/15 23:53:24 1.1
+++ linux/mm/swapfile.c 1998/06/16 00:25:51
@@ -3,6 +3,8 @@
*
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
* Swap reorganised 29.12.95, Stephen Tweedie
+ * Stopped kswapd during try_to_unuse() to avoid deadlock
+ * after a `swapoff -a` 16 June 1998 by Andrea Arcangeli.
*/

#include <linux/mm.h>
@@ -391,7 +393,9 @@
swap_list.next = swap_list.head;
}
p->flags = SWP_USED;
+ timer_active &= ~(1<<SWAP_TIMER);
err = try_to_unuse(type);
+ timer_active |= (1<<SWAP_TIMER);
if (err) {
dput(dentry);
/* re-insert swap space back into swap_list */

Andrea[s] Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu