lkml.org 
[lkml]   [1997]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPage cache patch for pre-2.0.31-9
Hi all!
Well, this patch fixes one of the most important features of the linux kernel
- keeping the page cache pages in memory for any price. I know that this
is a non acceptable change for many people, so I made it a config option.
I don't think that it will go into the standard kernel, but I'm going to
maintain it at least for the 2.0 series. With this patch I can run linux
+ X + netscape + some rxvt's in 8 MB with good responsibility.
Regards
Krzysztof Strasburger

--- linux.orig/mm/filemap.c.orig Thu Aug 7 11:25:00 1997
+++ linux/mm/filemap.c Thu Aug 7 12:04:02 1997
@@ -157,6 +157,15 @@

switch (page->count) {
case 1:
+#ifdef CONFIG_FREE_PAGE_CACHE
+ /* is it a page cache page? */
+ if (page->inode) {
+ remove_page_from_hash_queue(page);
+ remove_page_from_inode_queue(page);
+ __free_page(page);
+ return 1;
+ }
+#endif
/* If it has been referenced recently, don't free it */
if (clear_bit(PG_referenced, &page->flags)) {
/* age this page potential used */
@@ -165,6 +174,7 @@
break;
}

+#ifndef CONFIG_FREE_PAGE_CACHE
/* is it a page cache page? */
if (page->inode) {
remove_page_from_hash_queue(page);
@@ -172,6 +182,7 @@
__free_page(page);
return 1;
}
+#endif

/* is it a buffer cache page? */
if (bh && try_to_free_buffer(bh, &bh, 6))
@@ -180,7 +191,12 @@

default:
/* more than one users: we can't throw it away */
+#ifdef CONFIG_FREE_PAGE_CACHE
+ if (page->inode && (!clear_bit(PG_referenced,&page->flags)))
+ age_page(page);
+#else
set_bit(PG_referenced, &page->flags);
+#endif
/* fall through */
case 0:
/* nothing */
diff -u --recursive --unidirectional-new-file linux.orig/mm/Config.in linux/mm/Config.in
--- linux.orig/mm/Config.in Thu Jan 1 00:00:00 1970
+++ linux/mm/Config.in Thu Aug 7 12:22:14 1997
@@ -0,0 +1,7 @@
+# Memory management configuration
+mainmenu_option next_comment
+comment 'Memory management configuration'
+
+bool 'Free page cache pages aggressively' CONFIG_FREE_PAGE_CACHE
+
+endmenu
--- linux.orig/arch/i386/config.in Mon May 13 04:17:23 1996
+++ linux/arch/i386/config.in Thu Aug 7 12:13:39 1997
@@ -45,6 +45,8 @@
PPro CONFIG_M686" Pentium
endmenu

+source mm/Config.in
+
source drivers/block/Config.in

if [ "$CONFIG_NET" = "y" ]; then
--- linux.orig/arch/alpha/config.in Mon Aug 5 07:13:50 1996
+++ linux/arch/alpha/config.in Thu Aug 7 12:34:23 1997
@@ -96,6 +96,8 @@
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
endmenu

+source mm/Config.in
+
source drivers/block/Config.in

if [ "$CONFIG_NET" = "y" ]; then
--- linux.orig/arch/m68k/config.in Mon May 20 04:54:26 1996
+++ linux/arch/m68k/config.in Thu Aug 7 12:34:21 1997
@@ -33,6 +33,8 @@
fi
endmenu

+source mm/Config.in
+
#
# Block device driver configuration
#
--- linux.orig/arch/mips/config.in Sun May 5 06:05:58 1996
+++ linux/arch/mips/config.in Thu Aug 7 12:34:25 1997
@@ -57,6 +57,8 @@
bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS
endmenu

+source mm/Config.in
+
source drivers/block/Config.in

if [ "$CONFIG_NET" = "y" ]; then
--- linux.orig/arch/ppc/config.in Mon May 27 09:00:57 1996
+++ linux/arch/ppc/config.in Thu Aug 7 12:34:20 1997
@@ -38,6 +38,8 @@
bool 'Compile kernel as ELF - if your GCC is ELF-GCC' CONFIG_KERNEL_ELF
fi

+source mm/Config.in
+
source drivers/block/Config.in

if [ "$CONFIG_NET" = "y" ]; then
--- linux.orig/arch/sparc/config.in Thu Apr 25 10:22:05 1996
+++ linux/arch/sparc/config.in Thu Aug 7 12:34:24 1997
@@ -31,6 +31,8 @@
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
endmenu

+source mm/Config.in
+
mainmenu_option next_comment
comment 'Floppy, IDE, and other block devices'

--- linux.orig/Documentation/Configure.help Tue Aug 5 09:01:41 1997
+++ linux/Documentation/Configure.help Thu Aug 7 12:51:21 1997
@@ -79,6 +79,15 @@
arch/i386/math-emu/README. If you are not sure, say Y; apart from
resulting in a 45kB bigger kernel, it won't hurt.

+Free page cache pages aggressively
+CONFIG_FREE_PAGE_CACHE
+ By default shared page cache and buffer pages are marked as referenced.
+ It makes freeing them very difficult (especially for the page cache).
+ If this option is enabled, shared pages are not marked. Additionally,
+ non referenced pages are aged. It may make low memory machines more
+ usable, as non referenced shared pages are freed aggressively and
+ swapping out of data pages is avoided.
+
Normal floppy disk support
CONFIG_BLK_DEV_FD
If you want to use your floppy disk drive(s) under Linux, say
\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.026 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site