Skip to contentSkip to conversation

Conditionally call unlock_page() in hugetlb_fault()

PATCH New Dean Nelson 1 participant 1 message Nov 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Conditionally call unlock_page() in hugetlb_fault()

Have hugetlb_fault() call unlock_page(page) only if it had previously called lock_page(page).

---

Setting CONFIG_DEBUG_VM=y and then running the libhugetlbfs test suite, resulted in the tripping of VM_BUG_ON(!PageLocked(page)) in unlock_page() having been called by hugetlb_fault() when page == pagecache_page. This patch remedied the problem.

 mm/hugetlb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
mm/hugetlb.c +2 -1
index c4a3558..8585524 100644
@@ -2738,7 +2738,8 @@ out_page_table_lock:
 		unlock_page(pagecache_page);
 		put_page(pagecache_page);
 	}
-	unlock_page(page);
+	if (page != pagecache_page)
+		unlock_page(page);
 
 out_mutex:
 	mutex_unlock(&hugetlb_instantiation_mutex);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>