lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 Apr 2015 11:41:18 +0100
From:	Mel Gorman <mgorman@...e.de>
To:	Linux-MM <linux-mm@...ck.org>
Cc:	Rik van Riel <riel@...hat.com>, Hugh Dickins <hughd@...gle.com>,
	Minchan Kim <minchan@...nel.org>,
	Dave Hansen <dave.hansen@...el.com>,
	Andi Kleen <andi@...stfloor.org>,
	LKML <linux-kernel@...r.kernel.org>, Mel Gorman <mgorman@...e.de>
Subject: [PATCH 4/6] mm, migrate: Drop references to successfully migrated pages at the same time

After each migration attempt, putback_lru_page() is used to drop the last
reference to the page.  This is fine but it prevents the batching of TLB
flushes because the flush must happen before a free. This patch drops all
the migrated pages at once in preparation for batching the TLB flush.

Signed-off-by: Mel Gorman <mgorman@...e.de>
---
 mm/migrate.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 85e042686031..82c98c5aa6ed 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -906,7 +906,7 @@ out:
  */
 static int unmap_and_move(new_page_t get_new_page, free_page_t put_new_page,
 			unsigned long private, struct page *page, int force,
-			enum migrate_mode mode)
+			enum migrate_mode mode, struct list_head *putback_list)
 {
 	int rc = 0;
 	int *result = NULL;
@@ -937,7 +937,7 @@ out:
 		list_del(&page->lru);
 		dec_zone_page_state(page, NR_ISOLATED_ANON +
 				page_is_file_cache(page));
-		putback_lru_page(page);
+		list_add(&page->lru, putback_list);
 	}
 
 	/*
@@ -1086,6 +1086,7 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 		free_page_t put_new_page, unsigned long private,
 		enum migrate_mode mode, int reason)
 {
+	LIST_HEAD(putback_list);
 	int retry = 1;
 	int nr_failed = 0;
 	int nr_succeeded = 0;
@@ -1110,7 +1111,8 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 						pass > 2, mode);
 			else
 				rc = unmap_and_move(get_new_page, put_new_page,
-						private, page, pass > 2, mode);
+						private, page, pass > 2, mode,
+						&putback_list);
 
 			switch(rc) {
 			case -ENOMEM:
@@ -1135,6 +1137,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 	}
 	rc = nr_failed + retry;
 out:
+	while (!list_empty(&putback_list)) {
+		page = list_entry(putback_list.prev, struct page, lru);
+		list_del(&page->lru);
+		putback_lru_page(page);
+	}
+
 	if (nr_succeeded)
 		count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded);
 	if (nr_failed)
-- 
2.1.2

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ