mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Hillf Danton <dhillf@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 1/3] balancenuma: put page if avoid migrating page
Date: Tue, 27 Nov 2012 14:16:15 +0000	[thread overview]
Message-ID: <20121127141615.GA20087@suse.de> (raw)
In-Reply-To: <20121127140705.GP8218@suse.de>

On Tue, Nov 27, 2012 at 02:07:05PM +0000, Mel Gorman wrote:
> 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@gmail.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.
> 

After slotting the fix into the right place in the series and resolving
the conflict, the overall diff looks like;

diff --git a/mm/migrate.c b/mm/migrate.c
index b0c1585..ed0bdea 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1515,6 +1515,8 @@ bool numamigrate_update_ratelimit(pg_data_t *pgdat)
 
 int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
 {
+	int ret = 0;
+
 	/* Avoid migrating to a node that is nearly full */
 	if (migrate_balanced_pgdat(pgdat, 1)) {
 		int page_lru;
@@ -1524,13 +1526,8 @@ int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
 			return 0;
 		}
 
-		/*
-		 * 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 is isolated */
+		ret = 1;
 		page_lru = page_is_file_cache(page);
 		if (!PageTransHuge(page))
 			inc_zone_page_state(page, NR_ISOLATED_ANON + page_lru);
@@ -1540,7 +1537,17 @@ int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
 					HPAGE_PMD_NR);
 	}
 
-	return 1;
+	/*
+	 * 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);
+
+	return ret;
 }
 
 /*

  reply	other threads:[~2012-11-27 14:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 13:23 Hillf Danton
2012-11-27 14:07 ` Mel Gorman
2012-11-27 14:16   ` Mel Gorman [this message]
2012-11-28 20:48     ` Hugh Dickins
2012-11-28 13:59   ` Hillf Danton

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=20121127141615.GA20087@suse.de \
    --to=mgorman@suse.de \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /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

all inboxes | Powered by JetHome®