From: Minchan Kim <minchan.kim@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Minchan Kim <minchan.kim@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
Michal Hocko <mhocko@suse.cz>,
Andrea Arcangeli <aarcange@redhat.com>
Subject: [PATCH v4 10/10] compaction: add drain ilru of pagevec
Date: Thu, 30 Jun 2011 23:55:20 +0900 [thread overview]
Message-ID: <4aa25fb2c92b23887a8980d3e32fe29d3ab0ca30.1309444658.git.minchan.kim@gmail.com> (raw)
In-Reply-To: <cover.1309444657.git.minchan.kim@gmail.com>
In-Reply-To: <cover.1309444657.git.minchan.kim@gmail.com>
inorder_lru checks whether previous page of drained page is
in lru. If it isn't in lru, same_lru returns false and inorder_lru
got failed which would be frequent in heavy memory pressure as
previous page is in ilru pagevec. It's not desireable.
In addtion, fast returning of migrated page into LRU is important
in case of reclaiming pages by compation and kswapd/other direct
reclaim happens by parallel. That's because the pages in ilru pagevec
might be really tail of LRU so we can prevent eviction working set pages.
The elaspsed time of decompress 10GB in my experiment is following as.
inorder_lru inorder_lru + drain pagevec
01:43:16.16 01:40:27.18
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
include/linux/swap.h | 2 ++
mm/compaction.c | 2 ++
mm/swap.c | 13 +++++++++++++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 78f5249..6aafb75 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -217,6 +217,8 @@ extern unsigned int nr_free_pagecache_pages(void);
/* linux/mm/swap.c */
+extern void drain_ilru_pagevecs(int cpu);
+extern void __ilru_cache_add(struct page *, enum lru_list lru);
extern void __ilru_cache_add(struct page *, enum lru_list lru);
extern void __lru_cache_add(struct page *, enum lru_list lru);
extern void lru_cache_add_ilru(struct page *, enum lru_list lru);
diff --git a/mm/compaction.c b/mm/compaction.c
index 7bc784a..a515639 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -573,6 +573,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
cc->nr_migratepages = 0;
}
+ drain_ilru_pagevecs(get_cpu());
+ put_cpu();
}
out:
diff --git a/mm/swap.c b/mm/swap.c
index f2ccf81..c2cf0e2 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -525,6 +525,19 @@ static void lru_deactivate_fn(struct page *page, void *arg)
update_page_reclaim_stat(zone, page, file, 0);
}
+void drain_ilru_pagevecs(int cpu)
+{
+ struct pagevec *pvecs = per_cpu(ilru_add_pvecs, cpu);
+ struct pagevec *pvec;
+ int lru;
+
+ for_each_lru(lru) {
+ pvec = &pvecs[lru - LRU_BASE];
+ if (pagevec_count(pvec))
+ ____pagevec_ilru_add(pvec, lru);
+ }
+}
+
/*
* Drain pages out of the cpu's pagevecs.
* Either "cpu" is the current CPU, and preemption has already been
--
1.7.4.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-06-30 14:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 14:55 [PATCH v4 00/10] Prevent LRU churning Minchan Kim
2011-06-30 14:55 ` [PATCH v4 01/10] compaction: trivial clean up acct_isolated Minchan Kim
2011-06-30 14:55 ` [PATCH v4 02/10] Change isolate mode from #define to bitwise type Minchan Kim
2011-06-30 14:55 ` [PATCH v4 03/10] compaction: make isolate_lru_page with filter aware Minchan Kim
2011-06-30 14:55 ` [PATCH v4 04/10] zone_reclaim: " Minchan Kim
2011-06-30 14:55 ` [PATCH v4 05/10] migration: clean up unmap_and_move Minchan Kim
2011-06-30 14:55 ` [PATCH v4 06/10] migration: introudce migrate_ilru_pages Minchan Kim
2011-06-30 14:55 ` [PATCH v4 07/10] compaction: make compaction use in-order putback Minchan Kim
2011-06-30 14:55 ` [PATCH v4 08/10] ilru: reduce zone->lru_lock Minchan Kim
2011-06-30 14:55 ` [PATCH v4 09/10] add inorder-lru tracepoints for just measurement Minchan Kim
2011-06-30 14:55 ` Minchan Kim [this message]
2011-06-30 15:02 ` [PATCH v4 00/10] Prevent LRU churning Minchan Kim
2011-07-04 14:04 Minchan Kim
2011-07-04 14:04 ` [PATCH v4 10/10] compaction: add drain ilru of pagevec Minchan Kim
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=4aa25fb2c92b23887a8980d3e32fe29d3ab0ca30.1309444658.git.minchan.kim@gmail.com \
--to=minchan.kim@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=riel@redhat.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