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>] [day] [month] [year] [list]
Date:	Wed, 14 May 2014 15:09:19 +0800
From:	Jianyu Zhan <nasa4836@...il.com>
To:	akpm@...ux-foundation.org, iamjoonsoo.kim@....com,
	n-horiguchi@...jp.nec.com, aneesh.kumar@...ux.vnet.ibm.com,
	mhocko@...e.cz, aarcange@...hat.com, steve.capper@...aro.org,
	davidlohr@...com, kirill.shutemov@...ux.intel.com,
	dave.hansen@...ux.intel.com
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	nasa4836@...il.com
Subject: [PATCH] mm, hugetlb: use list_for_each_entry in region_xxx

Commit 7b24d8616be3 ("mm, hugetlb: fix race in region tracking") has
changed to use a per resv_map spinlock to serialize against any
concurrent write operations to the resv_map, thus we don't need
list_for_each_entry_safe to interate over file_region's any more.
Use list_for_each_entry is enough.

Signed-off-by: Jianyu Zhan <nasa4836@...il.com>
---
 mm/hugetlb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c82290b..26b1464 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -156,7 +156,7 @@ struct file_region {
 static long region_add(struct resv_map *resv, long f, long t)
 {
 	struct list_head *head = &resv->regions;
-	struct file_region *rg, *nrg, *trg;
+	struct file_region *rg, *nrg;
 
 	spin_lock(&resv->lock);
 	/* Locate the region we are either in or before. */
@@ -170,7 +170,7 @@ static long region_add(struct resv_map *resv, long f, long t)
 
 	/* Check for and consume any regions we now overlap with. */
 	nrg = rg;
-	list_for_each_entry_safe(rg, trg, rg->link.prev, link) {
+	list_for_each_entry(rg, rg->link.prev, link) {
 		if (&rg->link == head)
 			break;
 		if (rg->from > t)
@@ -261,7 +261,7 @@ out_nrg:
 static long region_truncate(struct resv_map *resv, long end)
 {
 	struct list_head *head = &resv->regions;
-	struct file_region *rg, *trg;
+	struct file_region *rg;
 	long chg = 0;
 
 	spin_lock(&resv->lock);
@@ -280,7 +280,7 @@ static long region_truncate(struct resv_map *resv, long end)
 	}
 
 	/* Drop any remaining regions. */
-	list_for_each_entry_safe(rg, trg, rg->link.prev, link) {
+	list_for_each_entry(rg, rg->link.prev, link) {
 		if (&rg->link == head)
 			break;
 		chg += rg->to - rg->from;
-- 
2.0.0-rc3

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ