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, 27 Nov 2012 14:07:05 +0000
From:	Mel Gorman <mgorman@...e.de>
To:	Hillf Danton <dhillf@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 1/3] balancenuma: put page if avoid migrating page

On Tue, Nov 27, 2012 at 09:23:59PM +0800, Hillf Danton wrote:
> If we have to avoid migrating to a node that is nearly full, put page
> and return zero.
> 
> Signed-off-by: Hillf Danton <dhillf@...il.com>

Correct. In this series, the bug was actually introduced back in "mm:
migrate: Introduce migrate_misplaced_page()" so I'm working the fix to
be a fix on top of that patch and will ensure it gets carried through
properly in the THP patch that happens at the end of the series. This will
work out better in terms of bisection if the tree gets merged and allows
a partial tree to be properly tested. Can I get your signed off on this
patch please? This would be applied on top of "mm: migrate: Introduce
migrate_misplaced_page()"

Thanks.

---8<---
Subject: [PATCH] mm: migrate: Drop the misplaced pages reference count if the
 target node is full

If we have to avoid migrating to a node that is nearly full, put page
and return zero.

[dhillf@...il.com: Original patch, signed-off is preferred]
Signed-off-by: Mel Gorman <mgorman@...e.de>
---
 mm/migrate.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index a2c4567..49878d7 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1489,18 +1489,21 @@ int migrate_misplaced_page(struct page *page, int node)
 		}
 		isolated = 1;
 
-		/*
-		 * Page is isolated which takes a reference count so now the
-		 * callers reference can be safely dropped without the page
-		 * disappearing underneath us during migration
-		 */
-		put_page(page);
-
 		page_lru = page_is_file_cache(page);
 		inc_zone_page_state(page, NR_ISOLATED_ANON + page_lru);
 		list_add(&page->lru, &migratepages);
 	}
 
+	/*
+	 * Page is either isolated or there is not enough space on the target
+	 * node. If isolated, then it has taken a reference count and the
+	 * callers reference can be safely dropped without the page
+	 * disappearing underneath us during migration. Otherwise the page is
+	 * not to be migrated but the callers reference should still be
+	 * dropped so it does not leak.
+	 */
+	put_page(page);
+
 	if (isolated) {
 		int nr_remaining;
 
--
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