From: Rik van Riel <riel@redhat.com>
From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Lee Schermerhorn <lee.schermerhorn@hp.com>,
Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: [PATCH -mm 22/25] Noreclaim and Mlocked pages vm events
Date: Fri, 06 Jun 2008 16:29:00 -0400 [thread overview]
Message-ID: <20080606202859.828203772@redhat.com> (raw)
In-Reply-To: 20080606202838.390050172@redhat.com
[-- Attachment #1: rvr-22-lts-noreclaim-vm-events.patch --]
[-- Type: text/plain, Size: 7246 bytes --]
From: Lee Schermerhorn <lee.schermerhorn@hp.com>
Against: 2.6.26-rc2-mm1
Add some event counters to vmstats for testing noreclaim/mlock.
Some of these might be interesting enough to keep around.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
---
include/linux/vmstat.h | 11 +++++++++++
mm/internal.h | 4 +++-
mm/mlock.c | 33 +++++++++++++++++++++++++--------
mm/vmscan.c | 16 +++++++++++++++-
mm/vmstat.c | 12 ++++++++++++
5 files changed, 66 insertions(+), 10 deletions(-)
Index: linux-2.6.26-rc2-mm1/include/linux/vmstat.h
===================================================================
--- linux-2.6.26-rc2-mm1.orig/include/linux/vmstat.h 2008-05-23 14:21:34.000000000 -0400
+++ linux-2.6.26-rc2-mm1/include/linux/vmstat.h 2008-06-06 16:06:48.000000000 -0400
@@ -41,6 +41,17 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS
#ifdef CONFIG_HUGETLB_PAGE
HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
#endif
+#ifdef CONFIG_NORECLAIM_LRU
+ NORECL_PGCULLED, /* culled to noreclaim list */
+ NORECL_PGSCANNED, /* scanned for reclaimability */
+ NORECL_PGRESCUED, /* rescued from noreclaim list */
+#ifdef CONFIG_NORECLAIM_MLOCK
+ NORECL_PGMLOCKED,
+ NORECL_PGMUNLOCKED,
+ NORECL_PGCLEARED,
+ NORECL_PGSTRANDED, /* unable to isolate on unlock */
+#endif
+#endif
NR_VM_EVENT_ITEMS
};
Index: linux-2.6.26-rc2-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.26-rc2-mm1.orig/mm/vmscan.c 2008-06-06 16:06:28.000000000 -0400
+++ linux-2.6.26-rc2-mm1/mm/vmscan.c 2008-06-06 16:06:48.000000000 -0400
@@ -453,12 +453,13 @@ int putback_lru_page(struct page *page)
{
int lru;
int ret = 1;
+ int was_nonreclaimable;
VM_BUG_ON(!PageLocked(page));
VM_BUG_ON(PageLRU(page));
lru = !!TestClearPageActive(page);
- ClearPageNoreclaim(page); /* for page_reclaimable() */
+ was_nonreclaimable = TestClearPageNoreclaim(page);
if (unlikely(!page->mapping)) {
/*
@@ -478,6 +479,10 @@ int putback_lru_page(struct page *page)
lru += page_file_cache(page);
lru_cache_add_lru(page, lru);
mem_cgroup_move_lists(page, lru);
+#ifdef CONFIG_NORECLAIM_LRU
+ if (was_nonreclaimable)
+ count_vm_event(NORECL_PGRESCUED);
+#endif
} else {
/*
* Put non-reclaimable pages directly on zone's noreclaim
@@ -485,6 +490,10 @@ int putback_lru_page(struct page *page)
*/
add_page_to_noreclaim_list(page);
mem_cgroup_move_lists(page, LRU_NORECLAIM);
+#ifdef CONFIG_NORECLAIM_LRU
+ if (!was_nonreclaimable)
+ count_vm_event(NORECL_PGCULLED);
+#endif
}
put_page(page); /* drop ref from isolate */
@@ -2366,6 +2375,7 @@ static void check_move_noreclaim_page(st
__dec_zone_state(zone, NR_NORECLAIM);
list_move(&page->lru, &zone->list[l]);
__inc_zone_state(zone, NR_INACTIVE_ANON + l);
+ __count_vm_event(NORECL_PGRESCUED);
} else {
/*
* rotate noreclaim list
@@ -2397,6 +2407,7 @@ void scan_mapping_noreclaim_pages(struct
while (next < end &&
pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
int i;
+ int pg_scanned = 0;
zone = NULL;
@@ -2405,6 +2416,7 @@ void scan_mapping_noreclaim_pages(struct
pgoff_t page_index = page->index;
struct zone *pagezone = page_zone(page);
+ pg_scanned++;
if (page_index > next)
next = page_index;
next++;
@@ -2435,6 +2447,8 @@ void scan_mapping_noreclaim_pages(struct
if (zone)
spin_unlock_irq(&zone->lru_lock);
pagevec_release(&pvec);
+
+ count_vm_events(NORECL_PGSCANNED, pg_scanned);
}
}
Index: linux-2.6.26-rc2-mm1/mm/vmstat.c
===================================================================
--- linux-2.6.26-rc2-mm1.orig/mm/vmstat.c 2008-06-06 16:06:38.000000000 -0400
+++ linux-2.6.26-rc2-mm1/mm/vmstat.c 2008-06-06 16:06:48.000000000 -0400
@@ -759,6 +759,18 @@ static const char * const vmstat_text[]
"htlb_buddy_alloc_success",
"htlb_buddy_alloc_fail",
#endif
+
+#ifdef CONFIG_NORECLAIM_LRU
+ "noreclaim_pgs_culled",
+ "noreclaim_pgs_scanned",
+ "noreclaim_pgs_rescued",
+#ifdef CONFIG_NORECLAIM_MLOCK
+ "noreclaim_pgs_mlocked",
+ "noreclaim_pgs_munlocked",
+ "noreclaim_pgs_cleared",
+ "noreclaim_pgs_stranded",
+#endif
+#endif
#endif
};
Index: linux-2.6.26-rc2-mm1/mm/mlock.c
===================================================================
--- linux-2.6.26-rc2-mm1.orig/mm/mlock.c 2008-06-06 16:06:38.000000000 -0400
+++ linux-2.6.26-rc2-mm1/mm/mlock.c 2008-06-06 16:06:48.000000000 -0400
@@ -18,6 +18,7 @@
#include <linux/rmap.h>
#include <linux/mmzone.h>
#include <linux/hugetlb.h>
+#include <linux/vmstat.h>
#include "internal.h"
@@ -57,6 +58,7 @@ void __clear_page_mlock(struct page *pag
VM_BUG_ON(!PageLocked(page)); /* for LRU islolate/putback */
dec_zone_page_state(page, NR_MLOCK);
+ count_vm_event(NORECL_PGCLEARED);
if (!isolate_lru_page(page)) {
putback_lru_page(page);
} else {
@@ -66,6 +68,8 @@ void __clear_page_mlock(struct page *pag
lru_add_drain_all();
if (!isolate_lru_page(page))
putback_lru_page(page);
+ else if (PageNoreclaim(page))
+ count_vm_event(NORECL_PGSTRANDED);
}
}
@@ -79,6 +83,7 @@ void mlock_vma_page(struct page *page)
if (!TestSetPageMlocked(page)) {
inc_zone_page_state(page, NR_MLOCK);
+ count_vm_event(NORECL_PGMLOCKED);
if (!isolate_lru_page(page))
putback_lru_page(page);
}
@@ -109,16 +114,28 @@ static void munlock_vma_page(struct page
if (TestClearPageMlocked(page)) {
dec_zone_page_state(page, NR_MLOCK);
if (!isolate_lru_page(page)) {
- try_to_unlock(page); /* maybe relock the page */
+ int ret = try_to_unlock(page);
+ /*
+ * did try_to_unlock() succeed or punt?
+ */
+ if (ret == SWAP_SUCCESS || ret == SWAP_AGAIN)
+ count_vm_event(NORECL_PGMUNLOCKED);
+
putback_lru_page(page);
+ } else {
+ /*
+ * We lost the race. let try_to_unmap() deal
+ * with it. At least we get the page state and
+ * mlock stats right. However, page is still on
+ * the noreclaim list. We'll fix that up when
+ * the page is eventually freed or we scan the
+ * noreclaim list.
+ */
+ if (PageNoreclaim(page))
+ count_vm_event(NORECL_PGSTRANDED);
+ else
+ count_vm_event(NORECL_PGMUNLOCKED);
}
- /*
- * Else we lost the race. let try_to_unmap() deal with it.
- * At least we get the page state and mlock stats right.
- * However, page is still on the noreclaim list. We'll fix
- * that up when the page is eventually freed or we scan the
- * noreclaim list.
- */
}
}
Index: linux-2.6.26-rc2-mm1/mm/internal.h
===================================================================
--- linux-2.6.26-rc2-mm1.orig/mm/internal.h 2008-06-06 16:06:38.000000000 -0400
+++ linux-2.6.26-rc2-mm1/mm/internal.h 2008-06-06 16:06:48.000000000 -0400
@@ -107,8 +107,10 @@ static inline int is_mlocked_vma(struct
if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED))
return 0;
- if (!TestSetPageMlocked(page))
+ if (!TestSetPageMlocked(page)) {
inc_zone_page_state(page, NR_MLOCK);
+ count_vm_event(NORECL_PGMLOCKED);
+ }
return 1;
}
--
All Rights Reversed
next prev parent reply other threads:[~2008-06-06 20:34 UTC|newest]
Thread overview: 151+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-06 20:28 [PATCH -mm 00/25] VM pageout scalability improvements (V10) Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 01/25] move isolate_lru_page() to vmscan.c Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 02/25] Use an indexed array for LRU variables Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-07 5:43 ` KOSAKI Motohiro
2008-06-07 14:47 ` Rik van Riel
2008-06-08 11:22 ` KOSAKI Motohiro
2008-06-07 18:42 ` Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 03/25] use an array for the LRU pagevecs Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 04/25] free swap space on swap-in/activation Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-07 19:56 ` Rik van Riel
2008-06-09 2:14 ` MinChan Kim
2008-06-09 2:42 ` Rik van Riel
2008-06-09 13:38 ` KOSAKI Motohiro
2008-06-10 2:30 ` MinChan Kim
2008-06-06 20:28 ` [PATCH -mm 05/25] define page_file_cache() function Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-07 23:38 ` Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 06/25] split LRU lists into anon & file sets Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-07 1:22 ` Rik van Riel
2008-06-07 1:52 ` Andrew Morton
2008-06-06 20:28 ` [PATCH -mm 07/25] second chance replacement for anonymous pages Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-07 6:03 ` KOSAKI Motohiro
2008-06-07 6:43 ` Andrew Morton
2008-06-08 15:04 ` Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 08/25] add some sanity checks to get_scan_ratio Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-08 15:11 ` Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 09/25] fix pagecache reclaim referenced bit check Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-07 1:08 ` Rik van Riel
2008-06-08 10:02 ` Peter Zijlstra
2008-06-06 20:28 ` [PATCH -mm 10/25] add newly swapped in pages to the inactive list Rik van Riel, Rik van Riel
2008-06-07 1:04 ` Andrew Morton
2008-06-06 20:28 ` [PATCH -mm 11/25] more aggressively use lumpy reclaim Rik van Riel, Rik van Riel
2008-06-07 1:05 ` Andrew Morton
2008-06-06 20:28 ` [PATCH -mm 12/25] pageflag helpers for configed-out flags Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 13/25] Noreclaim LRU Infrastructure Rik van Riel, Rik van Riel
2008-06-06 20:28 ` Rik van Riel, Rik van Riel
2008-06-07 1:05 ` Andrew Morton
2008-06-07 1:05 ` Andrew Morton
2008-06-08 20:34 ` Rik van Riel
2008-06-08 20:34 ` Rik van Riel
2008-06-08 20:57 ` Andrew Morton
2008-06-08 20:57 ` Andrew Morton
2008-06-08 21:32 ` Rik van Riel
2008-06-08 21:32 ` Rik van Riel
2008-06-08 21:43 ` Ray Lee
2008-06-08 21:43 ` Ray Lee
2008-06-08 23:22 ` Andrew Morton
2008-06-08 23:22 ` Andrew Morton
2008-06-08 23:34 ` Rik van Riel
2008-06-08 23:34 ` Rik van Riel
2008-06-08 23:54 ` Andrew Morton
2008-06-08 23:54 ` Andrew Morton
2008-06-09 0:56 ` Rik van Riel
2008-06-09 0:56 ` Rik van Riel
2008-06-09 6:10 ` Andrew Morton
2008-06-09 6:10 ` Andrew Morton
2008-06-09 13:44 ` Rik van Riel
2008-06-09 13:44 ` Rik van Riel
2008-06-09 2:58 ` Rik van Riel
2008-06-09 2:58 ` Rik van Riel
2008-06-09 5:44 ` Andrew Morton
2008-06-09 5:44 ` Andrew Morton
2008-06-10 19:17 ` Christoph Lameter
2008-06-10 19:17 ` Christoph Lameter
2008-06-10 19:37 ` Rik van Riel
2008-06-10 19:37 ` Rik van Riel
2008-06-10 21:33 ` Andrew Morton
2008-06-10 21:33 ` Andrew Morton
2008-06-10 21:48 ` Andi Kleen
2008-06-10 21:48 ` Andi Kleen
2008-06-10 22:05 ` Dave Hansen
2008-06-10 22:05 ` Dave Hansen
2008-06-11 5:09 ` Paul Mundt
2008-06-11 5:09 ` Paul Mundt
2008-06-11 6:16 ` Andrew Morton
2008-06-11 6:16 ` Andrew Morton
2008-06-11 6:29 ` Paul Mundt
2008-06-11 6:29 ` Paul Mundt
2008-06-11 12:06 ` Andi Kleen
2008-06-11 12:06 ` Andi Kleen
2008-06-11 14:09 ` Removing node flags from page->flags was Re: [PATCH -mm 13/25] Noreclaim LRU Infrastructure II Andi Kleen
2008-06-11 14:09 ` Andi Kleen
2008-06-11 19:03 ` [PATCH -mm 13/25] Noreclaim LRU Infrastructure Andy Whitcroft
2008-06-11 19:03 ` Andy Whitcroft
2008-06-11 20:52 ` Andi Kleen
2008-06-11 20:52 ` Andi Kleen
2008-06-11 23:25 ` Christoph Lameter
2008-06-11 23:25 ` Christoph Lameter
2008-06-08 22:03 ` Rik van Riel
2008-06-08 22:03 ` Rik van Riel
2008-06-08 21:07 ` KOSAKI Motohiro
2008-06-08 21:07 ` KOSAKI Motohiro
2008-06-10 20:09 ` Rik van Riel
2008-06-10 20:09 ` Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 14/25] Noreclaim LRU Page Statistics Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 15/25] Ramfs and Ram Disk pages are non-reclaimable Rik van Riel, Rik van Riel
2008-06-06 20:28 ` Rik van Riel, Rik van Riel
2008-06-07 1:05 ` Andrew Morton
2008-06-07 1:05 ` Andrew Morton
2008-06-08 4:32 ` Greg KH
2008-06-08 4:32 ` Greg KH
2008-06-06 20:28 ` [PATCH -mm 16/25] SHM_LOCKED " Rik van Riel, Rik van Riel
2008-06-07 1:05 ` Andrew Morton
2008-06-07 5:21 ` KOSAKI Motohiro
2008-06-10 21:03 ` Rik van Riel
2008-06-10 21:22 ` Lee Schermerhorn
2008-06-10 21:49 ` Andrew Morton
2008-06-06 20:28 ` [PATCH -mm 17/25] Mlocked Pages " Rik van Riel, Rik van Riel
2008-06-06 20:28 ` Rik van Riel, Rik van Riel
2008-06-07 1:07 ` Andrew Morton
2008-06-07 1:07 ` Andrew Morton
2008-06-07 5:38 ` KOSAKI Motohiro
2008-06-07 5:38 ` KOSAKI Motohiro
2008-06-10 3:31 ` Nick Piggin
2008-06-10 3:31 ` Nick Piggin
2008-06-10 12:50 ` Rik van Riel
2008-06-10 12:50 ` Rik van Riel
2008-06-10 21:14 ` Rik van Riel
2008-06-10 21:14 ` Rik van Riel
2008-06-10 21:43 ` Lee Schermerhorn
2008-06-10 21:43 ` Lee Schermerhorn
2008-06-10 21:57 ` Andrew Morton
2008-06-10 21:57 ` Andrew Morton
2008-06-11 16:01 ` Lee Schermerhorn
2008-06-11 16:01 ` Lee Schermerhorn
2008-06-10 23:48 ` Rik van Riel
2008-06-10 23:48 ` Rik van Riel
2008-06-11 15:29 ` Lee Schermerhorn
2008-06-11 15:29 ` Lee Schermerhorn
2008-06-11 1:00 ` Rik van Riel
2008-06-11 1:00 ` Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 18/25] Downgrade mmap sem while populating mlocked regions Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 19/25] Handle mlocked pages during map, remap, unmap Rik van Riel, Rik van Riel
2008-06-06 20:28 ` Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 20/25] Mlocked Pages statistics Rik van Riel, Rik van Riel
2008-06-06 20:28 ` [PATCH -mm 21/25] Cull non-reclaimable pages in fault path Rik van Riel, Rik van Riel
2008-06-06 20:28 ` Rik van Riel, Rik van Riel, Lee Schermerhorn
2008-06-06 20:29 ` Rik van Riel, Rik van Riel [this message]
2008-06-06 20:29 ` [PATCH -mm 23/25] Noreclaim LRU scan sysctl Rik van Riel, Rik van Riel
2008-06-06 20:29 ` Rik van Riel, Rik van Riel, Lee Schermerhorn
2008-06-06 20:29 ` [PATCH -mm 24/25] Mlocked Pages: count attempts to free mlocked page Rik van Riel, Rik van Riel
2008-06-06 20:29 ` [PATCH -mm 25/25] Noreclaim LRU and Mlocked Pages Documentation Rik van Riel, Rik van Riel
2008-06-06 20:29 ` Rik van Riel, Rik van Riel
2008-06-06 21:02 ` [PATCH -mm 00/25] VM pageout scalability improvements (V10) Andrew Morton
2008-06-06 21:08 ` Rik van Riel
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=20080606202859.828203772@redhat.com \
--to=riel@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=lee.schermerhorn@hp.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.