lkml.org 
[lkml]   [1999]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPatch to free swap space and swap cache pages when on process exit
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


--- 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;
}
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.017 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site