Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1499569 > unrolled thread

[PATCH 3.4 121/125] Fix incomplete backport of commit 0f792cf949a0

Started bylizf@kernel.org
First post2016-10-12 14:50 +0200
Last post2016-10-12 14:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3.4 121/125] Fix incomplete backport of commit 0f792cf949a0 lizf@kernel.org - 2016-10-12 14:50 +0200

#1499569 — [PATCH 3.4 121/125] Fix incomplete backport of commit 0f792cf949a0

Fromlizf@kernel.org
Date2016-10-12 14:50 +0200
Subject[PATCH 3.4 121/125] Fix incomplete backport of commit 0f792cf949a0
Message-ID<srr8T-4rr-57@gated-at.bofh.it>
From: Zefan Li <lizefan@huawei.com>

3.4.113-rc1 review patch.  If anyone has any objections, please let me know.

------------------


Signed-off-by: Zefan Li <lizefan@huawei.com>
---
 mm/hugetlb.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 416cbfd..6726bfe 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2929,13 +2929,17 @@ out_page_table_lock:
 		unlock_page(pagecache_page);
 		put_page(pagecache_page);
 	}
-	if (page != pagecache_page)
-		unlock_page(page);
-	put_page(page);
-
 out_mutex:
 	mutex_unlock(&hugetlb_instantiation_mutex);
-
+	/*
+	 * Generally it's safe to hold refcount during waiting page lock. But
+	 * here we just wait to defer the next page fault to avoid busy loop and
+	 * the page is not used after unlocked before returning from the current
+	 * page fault. So we are safe from accessing freed page, even if we wait
+	 * here without taking refcount.
+	 */
+	if (need_wait_lock)
+		wait_on_page_locked(page);
 	return ret;
 }
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web