public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] free_swap_and_cache misses
@ 2002-01-21  0:21 Hugh Dickins
  2002-01-22  0:08 ` J.A. Magallon
  0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2002-01-21  0:21 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Linus Torvalds, Dave Jones, alad, linux-kernel

free_swap_and_cache() often misses its purpose and leaves freeable page
in swap and cache.  Wrong in mainline 2.4 and 2.5, but looks okay in -aa
(so don't bother to apply this if you're now merging that).

Hugh

--- 2.4.18-pre4/mm/swapfile.c	Sun Dec 23 10:47:32 2001
+++ linux/mm/swapfile.c	Sun Jan 20 23:30:52 2002
@@ -344,7 +344,7 @@
 	if (page) {
 		page_cache_get(page);
 		/* Only cache user (+us), or swap space full? Free it! */
-		if (page_count(page) == 2 || vm_swap_full()) {
+		if (page_count(page) - !!page->buffers == 2 || vm_swap_full()) {
 			delete_from_swap_cache(page);
 			SetPageDirty(page);
 		}


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

* Re: [PATCH] free_swap_and_cache misses
  2002-01-21  0:21 [PATCH] free_swap_and_cache misses Hugh Dickins
@ 2002-01-22  0:08 ` J.A. Magallon
  0 siblings, 0 replies; 2+ messages in thread
From: J.A. Magallon @ 2002-01-22  0:08 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Marcelo Tosatti, Linus Torvalds, Dave Jones, alad, linux-kernel


On 20020121 Hugh Dickins wrote:
>free_swap_and_cache() often misses its purpose and leaves freeable page
>in swap and cache.  Wrong in mainline 2.4 and 2.5, but looks okay in -aa
>(so don't bother to apply this if you're now merging that).
>
>Hugh
>
>--- 2.4.18-pre4/mm/swapfile.c	Sun Dec 23 10:47:32 2001
>+++ linux/mm/swapfile.c	Sun Jan 20 23:30:52 2002
>@@ -344,7 +344,7 @@
> 	if (page) {
> 		page_cache_get(page);
> 		/* Only cache user (+us), or swap space full? Free it! */
>-		if (page_count(page) == 2 || vm_swap_full()) {
>+		if (page_count(page) - !!page->buffers == 2 || vm_swap_full()) {

Don't you trust too much on precendence, people...?

-		if (page_count(page) == 2 || vm_swap_full()) {
+		if ( ((page_count(page) - !!page->buffers) == 2) || vm_swap_full() ) {

Or i'm paranoid.

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.18-pre4-beo #3 SMP Wed Jan 16 02:58:41 CET 2002 i686

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

end of thread, other threads:[~2002-01-22  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-21  0:21 [PATCH] free_swap_and_cache misses Hugh Dickins
2002-01-22  0:08 ` J.A. Magallon

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