Patch to free swap space and swap cache pages when on process exit

Larry Woodman (woodman@missioncriticallinux.com)
Thu, 30 Dec 1999 12:11:16 -0500


This is a multi-part message in MIME format.
--------------E6C9E971122D21977D5A2945
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

On 2.3.35 I am still seeing a problem where large virtual memory
allocations fail after the system has been up for a while and has been
under heavy loads. What is happening is one process malloc()s a large
buffer, modifies that buffer then sleeps.Then other processes
run and overcommit memory so the sleeping process gets swapped out.
Later the sleeping process wakes up and reads from the buffer, causing
lots of swapins and since the pages are read they stay in the swap
cache.
When this process exits many of those pages stay in the swap cache and
the swap space remains allocated. At this point other large memory
allocations can fail because vm_enough_memory() cant include the swap
space that remains allocated due to the dead process's pages in the swap

cache.

Part of the problem was fixed in 2.3.35 but I think
is_page_shared() still
needs this patch

Larry Woodman

--------------E6C9E971122D21977D5A2945
Content-Type: text/plain; charset=us-ascii;
name="patch-2.3.35.swapfree"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch-2.3.35.swapfree"

--- v2.3.35/linux/include/linux/swap.h Tue Dec 28 20:42:53 1999
+++ linux/include/linux/swap.h Thu Dec 30 12:57:02 1999
@@ -154,7 +154,8 @@
return 1;
count = page_count(page);
if (PageSwapCache(page))
- count += swap_count(page) - 2;
+ /* page count is 3 if shrink_mmap didnt free buffer yet */
+ count += swap_count(page) - 2 -!!page->buffers;
return count > 1;
}

--------------E6C9E971122D21977D5A2945--

-
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/