public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reclaim dirty dead swapcache pages
@ 2001-05-30 17:51 Marcelo Tosatti
  2001-05-30 20:32 ` Marcelo Tosatti
  0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2001-05-30 17:51 UTC (permalink / raw)
  To: lkml, Linus Torvalds; +Cc: Alan Cox


Hi, 

The following untested patch against 2.4.5-ac2 makes page_launder() free
dead swap cache pages by ignoring their age and/or referenced bits.

refill_inactive_scan() will move those pages to the inactive dirty list
whatever their age/referenced bit.

Testers are welcome (hum, needed). 

Linus,

I gaveup on the writepage() changes because 

1) it would (and it could not) ignore the page age. 
2) changing the API for such a reason on 2.4 is not reasonable, I think. 

I definately want writepage() changed to include the 'priority' argument,
in 2.5. 

--- linux.orig/mm/vmscan.c	Wed May 30 14:51:21 2001
+++ linux/mm/vmscan.c	Wed May 30 16:18:41 2001
@@ -461,6 +461,28 @@
 			continue;
 		}
 
+		/*
+		 * FIXME: this is a hack.
+		 *
+		 * Check for dead swap cache pages and clean
+		 * them as fast as possible, before doing any other checks.
+		 *
+		 * Note: We are guaranteeing that this page will never 
+		 * be touched in the future because a dirty page with no
+		 * other users than the swapcache will never be referenced
+		 * again.
+		 * 
+		 */
+
+		if (PageSwapCache(page) && PageDirty(page) &&
+				(page_count(page) - !!page->buffers) == 1 &&
+				swap_count(page) == 1) { 
+			ClearPageDirty(page);
+			ClearPageReferenced(page);
+			page->age = 0;
+		}
+
+			
 		/* Page is or was in use?  Move it to the active list. */
 		if (PageReferenced(page) || page->age > 0 ||
 				(!page->buffers && page_count(page) > 1) ||
@@ -686,6 +708,21 @@
 			nr_active_pages--;
 			continue;
 		}
+		
+		/*
+		 * FIXME: hack
+		 *
+		 * Special case for dead swap cache pages.
+		 * See comment on page_launder() for more info.
+		 */
+		if (PageSwapCache(page) && PageDirty(page) &&
+				(page_count(page) - !!page->buffers) == 1 &&
+				swap_count(page) == 1) {
+			deactivate_page_nolock(page);
+			nr_deactivated++;
+			continue;
+		}
+
 
 		/* Do aging on the pages. */
 		if (PageTestandClearReferenced(page)) {


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] reclaim dirty dead swapcache pages
  2001-05-30 17:51 [PATCH] reclaim dirty dead swapcache pages Marcelo Tosatti
@ 2001-05-30 20:32 ` Marcelo Tosatti
  2001-05-30 22:15   ` J . A . Magallon
  2001-05-31 18:20   ` Vasco Figueira
  0 siblings, 2 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2001-05-30 20:32 UTC (permalink / raw)
  To: lkml, Linus Torvalds; +Cc: Alan Cox



On Wed, 30 May 2001, Marcelo Tosatti wrote:

> 
> Hi, 
> 
> The following untested patch against 2.4.5-ac2 makes page_launder() free
> dead swap cache pages by ignoring their age and/or referenced bits.

I tested it and yes, it works. 

However I want more results before trying to push this to Alan. 

Its at
http://bazar.conectiva.com.br/~marcelo/patches/v2.4/2.4.5ac4/reapswap.patch

Please test. 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] reclaim dirty dead swapcache pages
  2001-05-30 22:15   ` J . A . Magallon
@ 2001-05-30 20:48     ` Marcelo Tosatti
  0 siblings, 0 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2001-05-30 20:48 UTC (permalink / raw)
  To: J . A . Magallon; +Cc: lkml



On Thu, 31 May 2001, J . A . Magallon wrote:

> 
> On 05.30 Marcelo Tosatti wrote:
> > 
> > 
> > Its at
> > http://bazar.conectiva.com.br/~marcelo/patches/v2.4/2.4.5ac4/reapswap.patch
> > 
> > Please test. 
> > 
> 
> Which kind of test, something like the gcc think I posted recently ?

I don't remember that, sorry. What was it again? 

> Just stress vm, fill swap, and try to do it again ?

For example.

I would _prefer_ tests non artifical tests, though. (ie not the kind of
workloads where tasks are trying to consume all available resources all
the time)

Still, any kind of report is welcome, of course. 

Thanks a lot! 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] reclaim dirty dead swapcache pages
  2001-05-30 20:32 ` Marcelo Tosatti
@ 2001-05-30 22:15   ` J . A . Magallon
  2001-05-30 20:48     ` Marcelo Tosatti
  2001-05-31 18:20   ` Vasco Figueira
  1 sibling, 1 reply; 6+ messages in thread
From: J . A . Magallon @ 2001-05-30 22:15 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: lkml


On 05.30 Marcelo Tosatti wrote:
> 
> 
> Its at
> http://bazar.conectiva.com.br/~marcelo/patches/v2.4/2.4.5ac4/reapswap.patch
> 
> Please test. 
> 

Which kind of test, something like the gcc think I posted recently ?
Just stress vm, fill swap, and try to do it again ?

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Linux Mandrake release 8.1 (Cooker) for i586
Linux werewolf 2.4.5-ac4 #1 SMP Wed May 30 00:17:45 CEST 2001 i686

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] reclaim dirty dead swapcache pages
  2001-05-30 20:32 ` Marcelo Tosatti
  2001-05-30 22:15   ` J . A . Magallon
@ 2001-05-31 18:20   ` Vasco Figueira
  2001-05-31 19:31     ` Vasco Figueira
  1 sibling, 1 reply; 6+ messages in thread
From: Vasco Figueira @ 2001-05-31 18:20 UTC (permalink / raw)
  To: linux-kernel

Hi,

Marcelo Tosatti wrote:

> I tested it and yes, it works. 
(...)
> Please test. 

I've tested it against vanilla 2.4.5 and it resolves the freeze problem, 
though:

I've opened x, gnome, mozilla, mozilla -mail, 3 gnome-terminals, pan, 
xmms, some files and javac. Swap was totally filled up and it didn't 
froze (good!). However suddently it came very busy (i thougth it was 
going to freeze again), the music stopped, and came back to normal 
again. It had killed xmms, I noticed after.

Is it intentional to kill processes? Well, it does reolve the problem, 
but kills some processes, probably the most eager ones. I will keep 
using this patch and report again if something relevant is found.

So far, so good, this is better tha having to swapoff & swapon all the 
time. Nice work Marcelo.
-- 
Regards,
                             Vasco Figueira

http://students.fct.unl.pt/users/vaf12086/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] reclaim dirty dead swapcache pages
  2001-05-31 18:20   ` Vasco Figueira
@ 2001-05-31 19:31     ` Vasco Figueira
  0 siblings, 0 replies; 6+ messages in thread
From: Vasco Figueira @ 2001-05-31 19:31 UTC (permalink / raw)
  To: linux-kernel

Hi again,

Vasco Figueira wrote:

 >I've opened x, gnome, mozilla, mozilla -mail, 3 gnome-terminals, pan, 
 >xmms, some files and javac. Swap was totally filled up and it didn't 
 >froze (good!). However suddently it came very busy (i thougth it was 
 >going to freeze again), the music stopped, and came back to normal 
 >again. It had killed xmms, I noticed after.

 >Is it intentional to kill processes? Well, it does reolve the problem, 
 >but kills some processes, probably the most eager ones. I will keep 
 >using this patch and report again if something relevant is found.

 >So far, so good, this is better tha having to swapoff & swapon all the 
 >time. Nice work Marcelo.

Continuing the saga of testing this patch, some more things:

* Swap gets *really* filled up. I don't remember having swap totally 
filled with 2.2. and this has 20M more (doesn't have to do with this 
patch, I think)

* kernel appears to try to free pages only when they are desperatly 
needed, i.e., when swap is full and a big process is needing mem. As an 
example, i was calm editing some text files (swap was full), and called 
javac. System went down to his knees, music stopped, mouse had repent 
stops and javac outputed:"Killed". I assume it was killed :-)

javac was called again and then ran more smootly. Perhaps because his 
pages were already there, no?

It may be better to try to free pages before we get into heavy load. If 
not, we get a pseudo-freeze and a killed process. Wich is not... wonderful.

Comments?
-- 
Regards,
                             Vasco Figueira

http://students.fct.unl.pt/users/vaf12086/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-05-31 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-30 17:51 [PATCH] reclaim dirty dead swapcache pages Marcelo Tosatti
2001-05-30 20:32 ` Marcelo Tosatti
2001-05-30 22:15   ` J . A . Magallon
2001-05-30 20:48     ` Marcelo Tosatti
2001-05-31 18:20   ` Vasco Figueira
2001-05-31 19:31     ` Vasco Figueira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox