]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Permit interruption of swapoff
authorAndrew Morton <akpm@digeo.com>
Sun, 20 Apr 2003 07:28:45 +0000 (00:28 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 20 Apr 2003 07:28:45 +0000 (00:28 -0700)
From: Hugh Dickins <hugh@veritas.com>

Sometimes you start a swapoff and, seeing how long it takes, wish you had
not: allow signal to interrupt and stop swapoff.

mm/swapfile.c

index 6cc7a47b6eba1529a98424192ebde68437d549da..144915b74734610217f3d4a1b9e2e8979f0b392a 100644 (file)
@@ -590,6 +590,11 @@ static int try_to_unuse(unsigned int type)
         * to swapoff for a while, then reappear - but that is rare.
         */
        while ((i = find_next_to_unuse(si, i))) {
+               if (signal_pending(current)) {
+                       retval = -EINTR;
+                       break;
+               }
+
                /* 
                 * Get a page for the entry, using the existing swap
                 * cache page if there is one.  Otherwise, get a clean
@@ -759,8 +764,7 @@ static int try_to_unuse(unsigned int type)
 
                /*
                 * Make sure that we aren't completely killing
-                * interactive performance.  Interruptible check on
-                * signal_pending() would be nice, but changes the spec?
+                * interactive performance.
                 */
                cond_resched();
        }