[PATCH] Swap cache leak...

From: David S. Miller (davem@redhat.com)
Date: Sat Apr 29 2000 - 02:22:19 EDT

  • Next message: chris_good@webtop.com: "IBM boxes [was Re: HIGH MEMORY access]"

    Can people test out this patch? Especially people who see
    the kernel go deeply into swap and never come fully out of it.

    The problem is that there is a piece of code during swapin
    readahead which backs out of the rest of the read-ahead operation if
    it will hit the async paging limit and block. In this case it loops
    releasing the swapcache entires it grabbed to do the I/O, but due to
    a off-by-one error it forgets to free up one of those entries.

    Here is the fix. One good way to test this, and see the bad behavior,
    is to run something which purposely exercises swapping, and after the
    test runs, try to turn off all of your swap partitions. When the bug
    is present, the swapoff syscall will fail (with -ENOMEM) due to this
    leak.

    Thanks, the patch is against 2.3.99-pre6.

    --- mm/memory.c.~1~ Mon Apr 24 19:16:59 2000
    +++ mm/memory.c Fri Apr 28 20:49:40 2000
    @@ -1016,8 +1016,11 @@
             for (i = 0; i < num; offset++, i++) {
                     /* Don't block on I/O for read-ahead */
                     if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster) {
    - while (i++ < num)
    - swap_free(SWP_ENTRY(SWP_TYPE(entry), offset++));
    + while (i < num) {
    + swap_free(SWP_ENTRY(SWP_TYPE(entry), offset));
    + offset++;
    + i++;
    + }
                             break;
                     }
                     /* Ok, do the async read-ahead now */

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Apr 29 2000 - 02:50:07 EDT