mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: page_launder() bug
Date: Mon, 7 May 2001 17:16:51 -0700 (PDT)	[thread overview]
Message-ID: <15095.15091.45238.172746@pizda.ninka.net> (raw)
In-Reply-To: <Pine.LNX.4.21.0105071920080.7515-100000@freak.distro.conectiva>
In-Reply-To: <Pine.LNX.4.21.0105071645070.7915-100000@penguin.transmeta.com> <Pine.LNX.4.21.0105071920080.7515-100000@freak.distro.conectiva>


Marcelo Tosatti writes:
 > My point is that its _ok_ for us to check if the page is a dead swap cache
 > page _without_ the lock since writepage() will recheck again with the page
 > _locked_. Quoting you two messages back: 
 > 
 > "But it is important to re-calculate the deadness after getting the lock.
 > Before, it was just an informed guess. After the lock, it is knowledge."
 > 
 > See ? 

In fact my patch isn't changing writepage behavior wrt. that page, it
is changing behavior with respect to laundering policy for that page.

Here, let's talk code a little bit so there are no misunderstandings,
I really want to put this to rest:

+		int dead_swap_page;
+
 		page = list_entry(page_lru, struct page, lru);
 
+		dead_swap_page =
+			(PageSwapCache(page) &&
+			 page_count(page) == (1 + !!page->buffers));
+

Calculate dead_swap_page outside of lock.

 		/* Page is or was in use?  Move it to the active list. */
-		if (PageTestandClearReferenced(page) || page->age > 0 ||
-				(!page->buffers && page_count(page) > 1) ||
-				page_ramdisk(page)) {
+		if (!dead_swap_page &&
+		    (PageTestandClearReferenced(page) || page->age > 0 ||
+		     (!page->buffers && page_count(page) > 1) ||
+		     page_ramdisk(page))) {
 			del_page_from_inactive_dirty_list(page);
 			add_page_to_active_list(page);
 			continue;

If dead_swap_page, ignore referenced bit heuristics.

-			/* First time through? Move it to the back of the list */
-			if (!launder_loop) {
+			/* First time through? Move it to the back of the list,
+			 * but not if it is a dead swap page. We want to reap
+			 * those as fast as possible.
+			 */
+			if (!launder_loop && !dead_swap_page) {
 				list_del(page_lru);
 				list_add(page_lru, &inactive_dirty_list);
 				UnlockPage(page);

If dead_swap_page, ignore launder_loop.  Again, another heuristic
test, not a "state correctness" test.  "launder_loop" is not
protecting "state correctness" of what we do to the page.

Really, what does this have to do with swap counts and page counts?

It's a heuristic. In fact it even seems stupid to me to recalculate
dead_swap_page after we get the lock just for the sake of these
heuristics.

Maybe I should have diguised this bit as:

if (dead_swap_page)
	do_writepage_first_pass = 1;

To divert people's brains to what the intent was :-)

Later,
David S. Miller
davem@redhat.com

  parent reply	other threads:[~2001-05-08  0:17 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-06 21:08 BERECZ Szabolcs
2001-05-06 21:59 ` Jonathan Morton
2001-05-06 22:07   ` BERECZ Szabolcs
2001-05-07  4:55 ` David S. Miller
2001-05-07  5:19   ` Aaron Lehmann
2001-05-07  6:26   ` Tobias Ringstrom
2001-05-07  8:59     ` Helge Hafting
2001-05-07 19:02       ` J . A . Magallon
2001-05-08  7:52         ` Helge Hafting
2001-05-10 12:19           ` Ingo Oeser
2001-05-10 10:51         ` Anuradha Ratnaweera
2001-05-07 10:52     ` Alan Cox
2001-05-07 13:49     ` Daniel Phillips
2001-05-07 13:53     ` H. Peter Anvin
2001-05-07  8:54   ` David S. Miller
2001-05-07 15:12     ` Tobias Ringstrom
2001-05-07 14:52   ` Horst von Brand
     [not found]     ` <davem@redhat.com>
2001-11-21  7:16       ` [VM/MEMORY-SICKNESS] 2.4.15-pre7 kmem_cache_create invalid opcode Jeff V. Merkey
2001-11-21  6:22         ` David S. Miller
2001-11-21  6:47           ` David S. Miller
2001-11-21  6:54             ` Jeff Merkey
2001-11-21  6:56             ` David S. Miller
2001-11-21  7:03               ` Jeff Merkey
2001-11-21  7:49                 ` arjan
2001-11-21 18:31                   ` Jeff Merkey
2001-11-21 19:06                     ` Doug Ledford
2001-11-21 19:51                       ` Jeff Merkey
2001-11-21 19:58                         ` J Sloan
2001-11-21 20:38                         ` Doug Ledford
2001-11-21 21:17                           ` Jeff Merkey
2001-11-21 19:16                     ` Arjan van de Ven
2001-11-21 19:53                       ` Jeff Merkey
2001-11-21 20:36                         ` Doug Ledford
2001-11-21 21:16                           ` Jeff Merkey
2001-11-21 21:28                           ` Robert Love
2001-11-21  7:09               ` David S. Miller
2001-11-21  7:14                 ` Jeff Merkey
2001-11-21  7:28               ` Stuart Young
2001-11-21  7:33           ` Jeff V. Merkey
2001-11-21  6:54             ` Chris Abbey
2001-11-21  7:05               ` Jeff Merkey
2001-11-21  6:47         ` Kai Henningsen
2001-11-21 18:28           ` Jeff Merkey
2001-11-21  8:49         ` Alan Cox
2001-11-21 18:28           ` Jeff Merkey
2001-05-08 17:59   ` page_launder() bug Kai Henningsen
2001-05-09  2:32   ` Rusty Russell
2001-05-09  8:43     ` Martin Dalecki
2001-05-09  3:36   ` Jonathan Morton
2001-05-07 17:59 ` Linus Torvalds
2001-05-07 21:22   ` Marcelo Tosatti
2001-05-07 23:23     ` Linus Torvalds
2001-05-07 21:50       ` Marcelo Tosatti
2001-05-07 23:52         ` Linus Torvalds
2001-05-07 22:26           ` Marcelo Tosatti
2001-05-08  2:29             ` Linus Torvalds
2001-05-13 16:08               ` Rik van Riel
2001-05-13 19:29                 ` Linus Torvalds
2001-05-14 22:05                   ` Marcelo Tosatti
2001-05-08  0:16           ` David S. Miller [this message]
2001-05-08  2:34             ` Linus Torvalds
2001-05-08  1:40               ` Marcelo Tosatti
2001-05-08  3:46                 ` Linus Torvalds
2001-05-08  2:37                   ` Marcelo Tosatti
2001-05-08 21:16                   ` Marcelo Tosatti
2001-05-08 23:38                     ` Linus Torvalds
2001-05-08 23:53                       ` Marcelo Tosatti
2001-05-09  2:13                       ` David S. Miller
2001-05-09 17:38                         ` Marcelo Tosatti
2001-05-09 20:05                         ` David S. Miller
2001-05-09 18:40                           ` Marcelo Tosatti
2001-05-09 21:08                           ` David S. Miller
2001-05-09 19:50                             ` Marcelo Tosatti
2001-05-13 16:34                         ` Rik van Riel
2001-05-13 19:34                           ` Linus Torvalds
2001-05-13 19:39                             ` Rik van Riel
2001-05-13 20:42                               ` Linus Torvalds
2001-05-14  7:05                                 ` Kai Henningsen
2001-05-13 17:52                         ` David S. Miller
2001-05-13 17:55                           ` Rik van Riel
2001-05-13 18:00                           ` David S. Miller
2001-05-08  6:50                 ` David S. Miller
2001-05-08  7:40                   ` Linus Torvalds
2001-05-08 18:53                     ` Marcelo Tosatti
2001-05-08  8:29                   ` David S. Miller
2001-05-08  3:22               ` David S. Miller
2001-05-08  3:26                 ` Linus Torvalds
2001-05-08  2:47             ` David S. Miller
2001-05-08  1:34               ` Marcelo Tosatti
2001-05-08  3:18               ` David S. Miller
2001-05-08  1:47                 ` Marcelo Tosatti
2001-05-08  3:24                 ` Linus Torvalds
2001-05-08  3:29                 ` David S. Miller
2001-05-08 10:36                   ` BERECZ Szabolcs
2001-05-08 12:33             ` Mikulas Patocka
2001-05-13 16:24               ` Rik van Riel
2001-05-13 21:02                 ` Another VM race? (was: page_launder() bug) Mikulas Patocka
2001-05-13 23:04                   ` Rik van Riel
2001-05-14  9:53                     ` Mikulas Patocka
2001-05-08  0:06         ` page_launder() bug David S. Miller
2001-05-07 23:31     ` David S. Miller
2001-05-07 22:44 ` David S. Miller
2001-05-08  1:00   ` Horst von Brand
2001-05-07  0:32 Jonathan Lundell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15095.15091.45238.172746@pizda.ninka.net \
    --to=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®