Re: linux-2.4.21 released

Ross Biro (rossb@google.com)
Fri, 13 Jun 2003 12:24:16 -0700


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-1618-1055533079-0001-2
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Here's a minor patch against 2.4.21 that should help reduce out of
memory problems on high ram systems with no swap space. It's only been
minimally tested in 2.4.21, but I've been running something similiar on
2.4.18 for a bit now.

Ross

--=_courier-1618-1055533079-0001-2
Content-Type: text/plain; name="no-swap.patch"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="no-swap.patch"

diff -urbBd linux-2.4.21/include/linux/swap.h linux-2.4.21-1/include/linux/swap.h
--- linux-2.4.21/include/linux/swap.h Fri Jun 13 07:51:39 2003
+++ linux-2.4.21-1/include/linux/swap.h Fri Jun 13 10:40:24 2003
@@ -82,6 +82,7 @@

/* Swap 50% full? Release swapcache more aggressively.. */
#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
+#define swap_avail() (nr_swap_pages > 0)

extern unsigned int nr_free_pages(void);
extern unsigned int nr_free_buffer_pages(void);
diff -urbBd linux-2.4.21/mm/vmscan.c linux-2.4.21-1/mm/vmscan.c
--- linux-2.4.21/mm/vmscan.c Thu Nov 28 15:53:15 2002
+++ linux-2.4.21-1/mm/vmscan.c Fri Jun 13 11:26:26 2003
@@ -474,6 +474,18 @@
spin_unlock(&pagecache_lock);
UnlockPage(page);
page_mapped:
+ /* if we don't have swap, it doesn't
+ do much good to swap things out. */
+ if (!page->mapping && !swap_avail()) {
+ /* Let's make the page active since we
+ cannot swap it out. It gets it off
+ the inactive list. */
+ spin_unlock(&pagemap_lru_lock);
+ activate_page(page);
+ ClearPageReferenced(page);
+ spin_lock(&pagemap_lru_lock);
+ continue;
+ }
if (--max_mapped >= 0)
continue;

--=_courier-1618-1055533079-0001-2--