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: [patch 2/2] stats for orphaned pages (-mm only)
Date: Mon, 20 Jun 2005 17:24:29 +1000 [thread overview]
Message-ID: <1119252269.6240.25.camel@npiggin-nld.site> (raw)
In-Reply-To: <1119252194.6240.22.camel@npiggin-nld.site>
[-- Attachment #1: Type: text/plain, Size: 40 bytes --]
And this.
--
SUSE Labs, Novell Inc.
[-- Attachment #2: vm-orphaned-debug.patch --]
[-- Type: text/x-patch, Size: 3300 bytes --]
Index: linux-2.6/mm/swap.c
===================================================================
--- linux-2.6.orig/mm/swap.c 2005-06-20 17:20:28.216728238 +1000
+++ linux-2.6/mm/swap.c 2005-06-20 17:21:38.253021265 +1000
@@ -114,8 +114,16 @@
struct zone *zone = page_zone(page);
spin_lock_irqsave(&zone->lru_lock, flags);
- ClearPageReferenced(page);
+ if (PageLRU(page))
+ SetPageOrphaned(page);
+ if (PageReferenced(page)) {
+ if (PageLRU(page))
+ inc_page_state(pg_orph_stripped);
+ ClearPageReferenced(page);
+ }
+
if (PageLRU(page) && PageActive(page)) {
+ inc_page_state(pg_orph_rotated);
list_move(&page->lru, &zone->inactive_list);
ClearPageActive(page);
}
Index: linux-2.6/include/linux/page-flags.h
===================================================================
--- linux-2.6.orig/include/linux/page-flags.h 2005-06-20 17:20:28.216728238 +1000
+++ linux-2.6/include/linux/page-flags.h 2005-06-20 17:20:56.005273542 +1000
@@ -77,6 +77,8 @@
#define PG_nosave_free 19 /* Free, should not be written */
#define PG_uncached 20 /* Page has been mapped as uncached */
+#define PG_orphaned 21
+
/*
* Global page accounting. One instance per CPU. Only unsigned longs are
* allowed.
@@ -132,6 +134,11 @@
unsigned long pgrotated; /* pages rotated to tail of the LRU */
unsigned long nr_bounce; /* pages for bounce buffers */
+
+ unsigned long pg_orph_stripped; /* Removed ref bit from orphaned page */
+ unsigned long pg_orph_rotated; /* Deactivated orphaned page */
+ unsigned long pg_orph_busy; /* Found orphans still busy */
+ unsigned long pg_orph_reclaim; /* Reclaimed orphan at first sight */
};
extern void get_page_state(struct page_state *ret);
@@ -306,6 +313,10 @@
#define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags)
#define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags)
+#define PageOrphaned(page) test_bit(PG_orphaned, &(page)->flags)
+#define SetPageOrphaned(page) set_bit(PG_orphaned, &(page)->flags)
+#define ClearPageOrphaned(page) clear_bit(PG_orphaned, &(page)->flags)
+
struct page; /* forward declaration */
int test_clear_page_dirty(struct page *page);
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c 2005-06-20 17:20:28.216728238 +1000
+++ linux-2.6/mm/page_alloc.c 2005-06-20 17:20:56.006273417 +1000
@@ -1899,6 +1899,11 @@
"pgrotated",
"nr_bounce",
+
+ "pg_orph_stripped",
+ "pg_orph_rotated",
+ "pg_orph_busy",
+ "pg_orph_reclaim",
};
static void *vmstat_start(struct seq_file *m, loff_t *pos)
Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c 2005-06-20 17:20:28.216728238 +1000
+++ linux-2.6/mm/vmscan.c 2005-06-20 17:21:26.171523247 +1000
@@ -522,6 +522,11 @@
__put_page(page);
free_it:
+ if (PageOrphaned(page)) {
+ inc_page_state(pg_orph_reclaim);
+ ClearPageOrphaned(page);
+ }
+
unlock_page(page);
reclaimed++;
if (!pagevec_add(&freed_pvec, page))
@@ -534,6 +539,11 @@
keep_locked:
unlock_page(page);
keep:
+ if (PageOrphaned(page)) {
+ inc_page_state(pg_orph_busy);
+ ClearPageOrphaned(page);
+ }
+
list_add(&page->lru, &ret_pages);
BUG_ON(PageLRU(page));
}
next prev parent reply other threads:[~2005-06-20 7:25 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 ` Nick Piggin [this message]
2005-06-20 7:36 ` [patch 2/2] stats for orphaned pages (-mm only) 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
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=1119252269.6240.25.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;
as well as URLs for NNTP newsgroup(s).