From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Lee Schermerhorn <Lee.Schermerhorn@hp.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>
Cc: kosaki.motohiro@jp.fujitsu.com
Subject: [mmotm][PATCH 3/9] revert migration change of unevictable lru infrastructure
Date: Tue, 15 Jul 2008 04:12:22 +0900 [thread overview]
Message-ID: <20080715041051.F6F8.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <20080715040402.F6EF.KOSAKI.MOTOHIRO@jp.fujitsu.com>
Patch title: unevictable-lru-infrastructure-revert-migration-change.patch
Against: mmotm Jul 14
Applies after: unevictable-lru-infrastructure-kill-unnecessary-lock_page.patch
Unevictable LRU Infrastructure patch changed several migration code because
Old version putback_lru_page() had needed to page lock.
it has little performance degression and isn't necessary now.
So, reverting is better.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
mm/migrate.c | 38 +++++++++++---------------------------
1 file changed, 11 insertions(+), 27 deletions(-)
Index: b/mm/migrate.c
===================================================================
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -67,11 +67,7 @@ int putback_lru_pages(struct list_head *
list_for_each_entry_safe(page, page2, l, lru) {
list_del(&page->lru);
- get_page(page);
- lock_page(page);
putback_lru_page(page);
- unlock_page(page);
- put_page(page);
count++;
}
return count;
@@ -583,8 +579,6 @@ static int move_to_new_page(struct page
struct address_space *mapping;
int rc;
- get_page(newpage); /* for prevent page release under lock_page() */
-
/*
* Block others from accessing the page when we get around to
* establishing additional references. We are the only one
@@ -617,12 +611,10 @@ static int move_to_new_page(struct page
if (!rc) {
remove_migration_ptes(page, newpage);
- putback_lru_page(newpage);
} else
newpage->mapping = NULL;
unlock_page(newpage);
- put_page(newpage);
return rc;
}
@@ -645,16 +637,13 @@ static int unmap_and_move(new_page_t get
if (page_count(page) == 1) {
/* page was freed from under us. So we are done. */
- get_page(page);
- goto end_migration;
+ goto move_newpage;
}
- get_page(page);
-
charge = mem_cgroup_prepare_migration(page, newpage);
if (charge == -ENOMEM) {
rc = -ENOMEM;
- goto end_migration;
+ goto move_newpage;
}
/* prepare cgroup just returns 0 or -ENOMEM */
BUG_ON(charge);
@@ -662,7 +651,7 @@ static int unmap_and_move(new_page_t get
rc = -EAGAIN;
if (TestSetPageLocked(page)) {
if (!force)
- goto end_migration;
+ goto move_newpage;
lock_page(page);
}
@@ -723,6 +712,7 @@ rcu_unlock:
rcu_read_unlock();
unlock:
+ unlock_page(page);
if (rc != -EAGAIN) {
/*
@@ -735,22 +725,16 @@ unlock:
putback_lru_page(page);
}
- unlock_page(page);
-
-end_migration:
- put_page(page);
-
+move_newpage:
if (!charge)
mem_cgroup_end_migration(newpage);
- if (!newpage->mapping) {
- /*
- * Migration failed or was never attempted.
- * Free the newpage.
- */
- VM_BUG_ON(page_count(newpage) != 1);
- put_page(newpage);
- }
+ /*
+ * Move the new page to the LRU. If migration was not successful
+ * then this will free the page.
+ */
+ putback_lru_page(newpage);
+
if (result) {
if (rc)
*result = rc;
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-07-14 19:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 19:06 [mmotm][PATCH 0/9] putback_lru_page() rework v5 KOSAKI Motohiro
2008-07-14 19:09 ` [mmotm][PATCH 1/9] putback_lru_page()/unevictable page handling rework KOSAKI Motohiro
2008-07-14 19:10 ` [mmotm][PATCH 2/9] kill unnecessary lock_page() in vmscan.c KOSAKI Motohiro
2008-07-14 19:12 ` KOSAKI Motohiro [this message]
2008-07-14 19:13 ` [mmotm][PATCH 4/9] revert shm change of shm_locked pages are unevictable patch KOSAKI Motohiro
2008-07-14 19:19 ` [mmotm][PATCH 5/9] mlock-mlocked-pages-are-unevictable.patch KOSAKI Motohiro
2008-07-23 9:07 ` Andrew Morton
2008-07-23 11:55 ` KOSAKI Motohiro
2008-07-24 5:45 ` KOSAKI Motohiro
2008-07-14 19:21 ` [mmotm][PATCH 6/9] restore patch failure hunk of mlock-mlocked-pages-are-unevictable.patch KOSAKI Motohiro
2008-07-14 19:24 ` [mmotm][PATCH 7/9] fix truncate race and sevaral comments KOSAKI Motohiro
2008-07-14 19:26 ` [mmotm][PATCH 8/9] vmstat-unevictable-and-mlocked-pages-vm-events.patch KOSAKI Motohiro
2008-07-14 19:27 ` [mmotm][PATCH 9/9] restore patch failure of vmstat-unevictable-and-mlocked-pages-vm-events.patch KOSAKI Motohiro
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=20080715041051.F6F8.KOSAKI.MOTOHIRO@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=Lee.Schermerhorn@hp.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--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