mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, andrea@suse.de, mason@suse.de
Subject: Re: [patch 1/2] vm early reclaim orphaned pages (take 2)
Date: Mon, 20 Jun 2005 17:32:36 +1000	[thread overview]
Message-ID: <1119252756.6240.27.camel@npiggin-nld.site> (raw)
In-Reply-To: <1119252194.6240.22.camel@npiggin-nld.site>

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]

On Mon, 2005-06-20 at 17:23 +1000, Nick Piggin wrote:
> How about this?
> 

Sorry, something else leaked into that. Updated patch attached.

-- 
SUSE Labs, Novell Inc.



[-- Attachment #2: vm-early-reclaim-orphaned.patch --]
[-- Type: text/x-patch, Size: 2826 bytes --]

We have workloads where orphaned pages build up and appear to slow
the system down when it starts reclaiming memory.

Stripping the referenced bit from orphaned pages and putting them
on the end of the inactive list should help improve reclaim.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/mm/truncate.c
===================================================================
--- linux-2.6.orig/mm/truncate.c	2005-06-01 16:09:34.000000000 +1000
+++ linux-2.6/mm/truncate.c	2005-06-20 17:05:41.011026426 +1000
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/pagevec.h>
+#include <linux/swap.h>
 #include <linux/buffer_head.h>	/* grr. try_to_release_page,
 				   block_invalidatepage */
 
@@ -48,9 +49,11 @@
 	if (page->mapping != mapping)
 		return;
 
-	if (PagePrivate(page))
-		do_invalidatepage(page, 0);
-
+	if (PagePrivate(page)) {
+		if (!(do_invalidatepage(page, 0)))
+			rotate_orphaned_page(page);
+	}
+				
 	clear_page_dirty(page);
 	ClearPageUptodate(page);
 	ClearPageMappedToDisk(page);
Index: linux-2.6/include/linux/swap.h
===================================================================
--- linux-2.6.orig/include/linux/swap.h	2005-06-01 16:09:26.000000000 +1000
+++ linux-2.6/include/linux/swap.h	2005-06-20 17:05:01.632921946 +1000
@@ -169,6 +169,7 @@
 extern void FASTCALL(mark_page_accessed(struct page *));
 extern void lru_add_drain(void);
 extern int rotate_reclaimable_page(struct page *page);
+extern void rotate_orphaned_page(struct page *page);
 extern void swap_setup(void);
 
 /* linux/mm/vmscan.c */
Index: linux-2.6/mm/swap.c
===================================================================
--- linux-2.6.orig/mm/swap.c	2004-12-25 08:34:31.000000000 +1100
+++ linux-2.6/mm/swap.c	2005-06-20 17:31:43.755744637 +1000
@@ -97,6 +97,32 @@
 }
 
 /*
+ * A page has been truncated, but is being orphaned on the LRU list due to
+ * a filesystem dependancy.
+ *
+ * Strip the referenced bit from this page, and if it is on the active list
+ * then put it on the head of the inactive list to aid page reclaim.
+ *
+ * We don't put it on the tail of the inactive list because the page is
+ * not able to be immediately freed due to filesystem dependancy (however
+ * in general, putting the page on the tail would probably be a win, but
+ * slightly more prone to introducing a regression).
+ */
+void rotate_orphaned_page(struct page *page)
+{
+	unsigned long flags;
+	struct zone *zone = page_zone(page);
+
+	spin_lock_irqsave(&zone->lru_lock, flags);
+	ClearPageReferenced(page);
+	if (PageLRU(page) && PageActive(page)) {
+		list_move(&page->lru, &zone->inactive_list);
+		ClearPageActive(page);
+	}
+	spin_unlock_irqrestore(&zone->lru_lock, flags);
+}
+
+/*
  * FIXME: speed this up?
  */
 void fastcall activate_page(struct page *page)

  parent reply	other threads:[~2005-06-20  7:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-17  3:23 [patch] vm early reclaim orphaned pages Nick Piggin
2005-06-17  3:34 ` Andrew Morton
2005-06-17  3:42   ` Nick Piggin
2005-06-17  4:20     ` Andrea Arcangeli
2005-06-20  7:23 ` [patch 1/2] vm early reclaim orphaned pages (take 2) Nick Piggin
2005-06-20  7:24   ` [patch 2/2] stats for orphaned pages (-mm only) Nick Piggin
2005-06-20  7:36     ` Andrew Morton
2005-06-20  7:49       ` Nick Piggin
2005-06-20  7:31   ` [patch 1/2] vm early reclaim orphaned pages (take 2) Andrew Morton
2005-06-20  7:32   ` Nick Piggin [this message]
2005-06-23  2:51     ` Rik Van Riel
2005-06-23  3:05       ` Nick Piggin

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=1119252756.6240.27.camel@npiggin-nld.site \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@suse.de \
    /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®