[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1388646744-15608-17-git-send-email-minchan@kernel.org>
Date: Thu, 2 Jan 2014 16:12:24 +0900
From: Minchan Kim <minchan@...nel.org>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>, Hugh Dickins <hughd@...gle.com>,
Dave Hansen <dave.hansen@...el.com>,
Rik van Riel <riel@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Michel Lespinasse <walken@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
John Stultz <john.stultz@...aro.org>,
Dhaval Giani <dhaval.giani@...il.com>,
"H. Peter Anvin" <hpa@...or.com>,
Android Kernel Team <kernel-team@...roid.com>,
Robert Love <rlove@...gle.com>, Mel Gorman <mel@....ul.ie>,
Dmitry Adamushko <dmitry.adamushko@...il.com>,
Dave Chinner <david@...morbit.com>, Neil Brown <neilb@...e.de>,
Andrea Righi <andrea@...terlinux.com>,
Andrea Arcangeli <aarcange@...hat.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Mike Hommey <mh@...ndium.org>, Taras Glek <tglek@...illa.com>,
Jan Kara <jack@...e.cz>,
KOSAKI Motohiro <kosaki.motohiro@...il.com>,
Rob Clark <robdclark@...il.com>, Jason Evans <je@...com>,
Minchan Kim <minchan@...nel.org>
Subject: [PATCH v10 16/16] vrange: Add vmstat counter about purged page
Adds some vmstat for analysise vrange working.
[PGDISCARD|PGVSCAN]_[KSWAPD|DIRECT] means purged page/scanning
so we could see effectiveness of vrange.
PGDISCARD_RESCUED means how many of pages we are missing in
core discarding logic of vrange so if it is big in no big memory
pressure, it may have a problem in scanning logic.
PGDISCARD_SAVE_RECLAIM means how many time we avoid reclaim via
discarding volatile pages but not sure how it is exact because
sc->nr_to_reclaim is very high if it were sc->prioirty is low(ie,
high memory pressure) so it it hard to meet the condition.
Maybe I would change the check via zone_watermark_ok.
Cc: Mel Gorman <mel@....ul.ie>
Cc: Hugh Dickins <hughd@...gle.com>
Cc: Dave Hansen <dave.hansen@...el.com>
Cc: Rik van Riel <riel@...hat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@...il.com>
Cc: Michel Lespinasse <walken@...gle.com>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: John Stultz <john.stultz@...aro.org>
Signed-off-by: Minchan Kim <minchan@...nel.org>
---
include/linux/vm_event_item.h | 6 ++++++
mm/vmscan.c | 8 ++++++--
mm/vmstat.c | 6 ++++++
mm/vrange.c | 14 ++++++++++++++
4 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 1855f0a22add..df0d8e9e0540 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -25,6 +25,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
FOR_ALL_ZONES(PGALLOC),
PGFREE, PGACTIVATE, PGDEACTIVATE,
PGFAULT, PGMAJFAULT,
+ PGVSCAN_KSWAPD,
+ PGVSCAN_DIRECT,
+ PGDISCARD_KSWAPD,
+ PGDISCARD_DIRECT,
+ PGDISCARD_RESCUED, /* rescued from shrink_page_list */
+ PGDISCARD_SAVE_RECLAIM, /* how many save reclaim */
FOR_ALL_ZONES(PGREFILL),
FOR_ALL_ZONES(PGSTEAL_KSWAPD),
FOR_ALL_ZONES(PGSTEAL_DIRECT),
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d8f45af1ab84..c88e48be010b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -886,8 +886,10 @@ static unsigned long shrink_page_list(struct list_head *page_list,
* because page->mapping could be NULL if it's purged.
*/
case PAGEREF_DISCARD:
- if (may_enter_fs && discard_vpage(page) == 0)
+ if (may_enter_fs && discard_vpage(page) == 0) {
+ count_vm_event(PGDISCARD_RESCUED);
goto free_it;
+ }
case PAGEREF_KEEP:
goto keep_locked;
case PAGEREF_RECLAIM:
@@ -1768,8 +1770,10 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
unsigned long nr_reclaimed;
nr_reclaimed = shrink_vrange(lru, lruvec, sc);
- if (nr_reclaimed >= sc->nr_to_reclaim)
+ if (nr_reclaimed >= sc->nr_to_reclaim) {
+ count_vm_event(PGDISCARD_SAVE_RECLAIM);
return nr_reclaimed;
+ }
if (is_active_lru(lru)) {
if (inactive_list_is_low(lruvec, lru))
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 9bb314577911..fa4eea4c5499 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -789,6 +789,12 @@ const char * const vmstat_text[] = {
"pgfault",
"pgmajfault",
+ "pgvscan_kswapd",
+ "pgvscan_direct",
+ "pgdiscard_kswapd",
+ "pgdiscard_direct",
+ "pgdiscard_rescued",
+ "pgdiscard_save_reclaim",
TEXTS_FOR_ZONES("pgrefill")
TEXTS_FOR_ZONES("pgsteal_kswapd")
diff --git a/mm/vrange.c b/mm/vrange.c
index 6cdbf6feed26..16de0a085453 100644
--- a/mm/vrange.c
+++ b/mm/vrange.c
@@ -1223,6 +1223,7 @@ static int discard_vrange(struct vrange *vrange, unsigned long *nr_discard,
{
int ret = 0;
struct vrange_root *vroot;
+ unsigned long total_scan = *scan;
vroot = vrange->owner;
vroot = vrange_get_vroot(vrange);
@@ -1244,6 +1245,19 @@ static int discard_vrange(struct vrange *vrange, unsigned long *nr_discard,
ret = __discard_vrange_file(mapping, vrange, nr_discard, scan);
}
+ if (!ret) {
+ if (current_is_kswapd())
+ count_vm_events(PGDISCARD_KSWAPD, *nr_discard);
+ else
+ count_vm_events(PGDISCARD_DIRECT, *nr_discard);
+ }
+
+ if (current_is_kswapd())
+ count_vm_events(PGVSCAN_KSWAPD,
+ (total_scan - *scan) >> PAGE_SHIFT);
+ else
+ count_vm_events(PGVSCAN_DIRECT,
+ (total_scan - *scan) >> PAGE_SHIFT);
out:
__vroot_put(vroot);
return ret;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists