Skip to contentSkip to conversation

consolidate spin_lock/unlock waiting with spin_unlock_wait

PATCH In review Nicholas Mc Guire 2 participants 2 messages Dec 2, 2013 – Dec 15, 2013 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 consolidate spin_lock/unlock waiting with spin_unlock_wait

Quoted 1 line

From 19ac7e10b38947dbd8d731a13243fb28490f5ab4 Mon Sep 17 00:00:00 2001

From: Nicholas Mc Guire <[email protected]>
Date: Sun, 1 Dec 2013 23:03:52 -0500
Subject: [PATCH] consolidate spin_lock/unlock waiting with spin_unlock_wait

since:
commit c2f21ce2e31286a0a32f8da0a7856e9ca1122ef3
Author: Thomas Gleixner <[email protected]>
Date: Wed Dec 2 20:02:59 2009 +0100

include/linux/spinlock.h includes spin_unlock_wait() to wait for a concurrent holder of a lock. this patch just moves over to that API. spin_unlock_wait covers both raw_spinlock_t and spinlock_t so it should be safe here as well. the added rt-variant of read_seqbegin in include/linux/seqlock.h that is being modified, was introduced by patch:
seqlock-prevent-rt-starvation.patch

patch is on top of 3.12.1-rt4

behavior should be unchanged.

---
 include/linux/seqlock.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
include/linux/seqlock.h +1 -2
index 142c0f7..019a936 100644
@@ -236,8 +236,7 @@ repeat:
 		 * Take the lock and let the writer proceed (i.e. evtl
 		 * boost it), otherwise we could loop here forever.
 		 */
-		spin_lock(&sl->lock);
-		spin_unlock(&sl->lock);
+		spin_unlock_wait(&sl->lock);
 		goto repeat;
 	}
 	return ret;
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 17 lines · * Nicholas Mc Guire | 2013-12-02 05:41:26 [+0100]:
Quoted 1 line

From 19ac7e10b38947dbd8d731a13243fb28490f5ab4 Mon Sep 17 00:00:00 2001

From: Nicholas Mc Guire <[email protected]>
Date: Sun, 1 Dec 2013 23:03:52 -0500
Subject: [PATCH] consolidate spin_lock/unlock waiting with spin_unlock_wait

since:
commit c2f21ce2e31286a0a32f8da0a7856e9ca1122ef3

Author: Thomas Gleixner <[email protected]>
Date:   Wed Dec 2 20:02:59 2009 +0100

include/linux/spinlock.h includes spin_unlock_wait() to wait for a concurrent holder of a lock. this patch just moves over to that API. spin_unlock_wait covers both raw_spinlock_t and spinlock_t so it should be safe here as well. the added rt-variant of read_seqbegin in include/linux/seqlock.h that is being modified, was introduced by patch:
seqlock-prevent-rt-starvation.patch

Quoted 3 lines

patch is on top of 3.12.1-rt4

behavior should be unchanged.

Applied. One note: you indented the comment by one space. It looked to me like cited to complete commit. Please do commit-id ("one line description) and avoid the one line space at the begin of everyline if possible.

Sebastian