All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] balancenuma: fix page locking in migrating thp
@ 2012-11-24  4:27 Hillf Danton
  2012-11-24 13:13 ` Mel Gorman
  0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2012-11-24  4:27 UTC (permalink / raw)
  To: Mel Gorman; +Cc: Hillf Danton, LKML

If fail to migrate thp(due to unsuccessful isolation), and if the original
pmd entry is changed after reaquiring page table lock, it is unsafe to
release the page lock as page maybe unstable.

It is fixed by raising extra page count before trying migration.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/huge_memory.c	Fri Nov 23 22:07:38 2012
+++ b/mm/huge_memory.c	Fri Nov 23 22:55:32 2012
@@ -1060,11 +1060,13 @@ int do_huge_pmd_numa_page(struct mm_stru
 	}
 	spin_unlock(&mm->page_table_lock);

+	get_page(page);
 	/* Migrate the THP to the requested node */
 	migrated = migrate_misplaced_transhuge_page(mm, vma,
 				pmdp, pmd, addr,
 				page, target_nid);
 	if (migrated) {
+		put_page(page);
 		count_vm_numa_event(NUMA_THP_MIGRATE_SUCCESS);
 		current_nid = target_nid;
 	} else {
@@ -1072,8 +1074,10 @@ int do_huge_pmd_numa_page(struct mm_stru
 		spin_lock(&mm->page_table_lock);
 		if (unlikely(!pmd_same(pmd, *pmdp))) {
 			unlock_page(page);
+			put_page(page);
 			goto out_unlock;
 		}
+		put_page(page);
 		goto clear_pmdnuma;
 	}

--

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-24 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-24  4:27 [PATCH 3/3] balancenuma: fix page locking in migrating thp Hillf Danton
2012-11-24 13:13 ` Mel Gorman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.