Skip to contentSkip to conversation

futex,plist: remove debug lock assignment for plist_node

PATCH In review Lai Jiangshan 2 participants 6 messages Dec 21, 2010 – Mar 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 futex,plist: remove debug lock assignment for plist_node

original code use &plist_node->plist as the faked head of the priority list for plist_del(), these debug locks in the faked head are needed for CONFIG_DEBUG_PI_LIST.

But now we always pass the real head to plist_del(), the debug locks in plist_node will not be used, so we remove these assignments.

---

kernel/futex.c +0 -9
index 6c4f67a..725834e 100644
@@ -1032,9 +1032,6 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
 		plist_del(&q->list, &hb1->chain);
 		plist_add(&q->list, &hb2->chain);
 		q->lock_ptr = &hb2->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-		q->list.plist.spinlock = &hb2->lock;
-#endif
 	}
 	get_futex_key_refs(key2);
 	q->key = *key2;
@@ -1068,9 +1065,6 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
 	q->rt_waiter = NULL;
 
 	q->lock_ptr = &hb->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock = &hb->lock;
-#endif
 
 	wake_up_state(q->task, TASK_NORMAL);
 }
@@ -1418,9 +1412,6 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
 	prio = min(current->normal_prio, MAX_RT_PRIO);
 
 	plist_node_init(&q->list, prio);
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock = &hb->lock;
-#endif
 	plist_add(&q->list, &hb->chain);
 	q->task = current;
 	spin_unlock(&hb->lock);
#1 lore raw
Quoted 6 lines · Lai Jiangshan

original code use&plist_node->plist as the faked head of the priority list for plist_del(), these debug locks in the faked head are needed for CONFIG_DEBUG_PI_LIST.

But now we always pass the real head to plist_del(), the debug locks in plist_node will not be used, so we remove these assignments.

Any reason to keep this separate from patch 1/4 ?

--
Darren

Quoted 37 lines

---

kernel/futex.c +0 -9
index 6c4f67a..725834e 100644
@@ -1032,9 +1032,6 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
  		plist_del(&q->list,&hb1->chain);
  		plist_add(&q->list,&hb2->chain);
  		q->lock_ptr =&hb2->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-		q->list.plist.spinlock =&hb2->lock;
-#endif
  	}
  	get_futex_key_refs(key2);
  	q->key = *key2;
@@ -1068,9 +1065,6 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
  	q->rt_waiter = NULL;
 
  	q->lock_ptr =&hb->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock =&hb->lock;
-#endif
 
  	wake_up_state(q->task, TASK_NORMAL);
  }
@@ -1418,9 +1412,6 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
  	prio = min(current->normal_prio, MAX_RT_PRIO);
 
  	plist_node_init(&q->list, prio);
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock =&hb->lock;
-#endif
  	plist_add(&q->list,&hb->chain);
  	q->task = current;
  	spin_unlock(&hb->lock);
Signature · 2 lines
Darren Hart
Yocto Linux Kernel
#2 lore raw
Quoted 10 lines · Darren Hart
Quoted 6 lines · Lai Jiangshan

original code use&plist_node->plist as the faked head of the priority list for plist_del(), these debug locks in the faked head are needed for CONFIG_DEBUG_PI_LIST.

But now we always pass the real head to plist_del(), the debug locks in plist_node will not be used, so we remove these assignments.

Any reason to keep this separate from patch 1/4 ?

Make the changes clearer and the patches are easier to read. For me the purposes of patch 1/4 and 2/4 are different, 1/4 makes the code sensible. 2/4 removes unused code.

#3 lore raw
Quoted 9 lines · Lai Jiangshan
Quoted 8 lines · Darren Hart
Quoted 6 lines · Lai Jiangshan

original code use&plist_node->plist as the faked head of the priority list for plist_del(), these debug locks in the faked head are needed for CONFIG_DEBUG_PI_LIST.

But now we always pass the real head to plist_del(), the debug locks in plist_node will not be used, so we remove these assignments.

Quoted 6 lines
Quoted 2 lines

Any reason to keep this separate from patch 1/4 ?

Make the changes clearer and the patches are easier to read. For me the purposes of patch 1/4 and 2/4 are different, 1/4 makes the code sensible. 2/4 removes unused code.

Fair enough.

Signature · 2 lines
Darren Hart
Yocto Linux Kernel
Acked-by on v1 2/4
#4 lore raw
In reply to Lai Jiangshan
Quoted 8 lines · Lai Jiangshan

original code use&plist_node->plist as the faked head of the priority list for plist_del(), these debug locks in the faked head are needed for CONFIG_DEBUG_PI_LIST.

But now we always pass the real head to plist_del(), the debug locks in plist_node will not be used, so we remove these assignments.

Quoted 35 lines

---

kernel/futex.c +0 -9
index 6c4f67a..725834e 100644
@@ -1032,9 +1032,6 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
  		plist_del(&q->list,&hb1->chain);
  		plist_add(&q->list,&hb2->chain);
  		q->lock_ptr =&hb2->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-		q->list.plist.spinlock =&hb2->lock;
-#endif
  	}
  	get_futex_key_refs(key2);
  	q->key = *key2;
@@ -1068,9 +1065,6 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
  	q->rt_waiter = NULL;
 
  	q->lock_ptr =&hb->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock =&hb->lock;
-#endif
 
  	wake_up_state(q->task, TASK_NORMAL);
  }
@@ -1418,9 +1412,6 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
  	prio = min(current->normal_prio, MAX_RT_PRIO);
 
  	plist_node_init(&q->list, prio);
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock =&hb->lock;
-#endif
  	plist_add(&q->list,&hb->chain);
  	q->task = current;
  	spin_unlock(&hb->lock);
Signature · 2 lines
Darren Hart
Yocto Linux Kernel
#5 lore raw

[tip:core/futexes] futex,plist: Remove debug lock assignment from plist_node

In reply to Lai Jiangshan
Commit-ID:  017f2b239dabb2740b91df162e004371b861f371
Gitweb:     http://git.kernel.org/tip/017f2b239dabb2740b91df162e004371b861f371
Author:     Lai Jiangshan <[email protected]>
AuthorDate: Tue, 21 Dec 2010 17:55:10 +0800
Committer:  Steven Rostedt <[email protected]>
CommitDate: Fri, 11 Mar 2011 15:09:53 -0500

futex,plist: Remove debug lock assignment from plist_node

The original code uses &plist_node->plist as the fake head of the priority list for plist_del(), these debug locks in the fake head are needed for CONFIG_DEBUG_PI_LIST.

But now we always pass the real head to plist_del(), the debug locks in plist_node will not be used, so we remove these assignments.

LKML-Reference: <[email protected]>

---
 kernel/futex.c |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)
kernel/futex.c +0 -9
index 6feeea4..9fe9131 100644
@@ -1089,9 +1089,6 @@ void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
 		plist_del(&q->list, &hb1->chain);
 		plist_add(&q->list, &hb2->chain);
 		q->lock_ptr = &hb2->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-		q->list.plist.spinlock = &hb2->lock;
-#endif
 	}
 	get_futex_key_refs(key2);
 	q->key = *key2;
@@ -1124,9 +1121,6 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
 	q->rt_waiter = NULL;
 
 	q->lock_ptr = &hb->lock;
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock = &hb->lock;
-#endif
 
 	wake_up_state(q->task, TASK_NORMAL);
 }
@@ -1474,9 +1468,6 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
 	prio = min(current->normal_prio, MAX_RT_PRIO);
 
 	plist_node_init(&q->list, prio);
-#ifdef CONFIG_DEBUG_PI_LIST
-	q->list.plist.spinlock = &hb->lock;
-#endif
 	plist_add(&q->list, &hb->chain);
 	q->task = current;
 	spin_unlock(&hb->lock);