Skip to contentSkip to conversation

rcupdate: remove dead code

PATCH Applied Amerigo Wang 2 participants 4 messages Jan 30, 2011 – Jan 31, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcupdate: remove dead code

DEBUG_OBJECTS_RCU_HEAD depends on PREEMPT, so #ifndef CONFIG_PREEMPT is totally useless in kernel/rcupdate.c.

Cc Paul E. McKenney <[email protected]>

---

kernel/rcupdate.c +0 -5
index a23a57a..afd21d1 100644
@@ -215,10 +215,6 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state)
 		 * If we detect that we are nested in a RCU read-side critical
 		 * section, we should simply fail, otherwise we would deadlock.
 		 */
-#ifndef CONFIG_PREEMPT
-		WARN_ON(1);
-		return 0;
-#else
 		if (rcu_preempt_depth() != 0 || preempt_count() != 0 ||
 		    irqs_disabled()) {
 			WARN_ON(1);
@@ -229,7 +225,6 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state)
 		rcu_barrier_bh();
 		debug_object_free(head, &rcuhead_debug_descr);
 		return 1;
-#endif
 	default:
 		return 0;
 	}
author
#1 lore raw
Quoted 2 lines · Amerigo Wang

DEBUG_OBJECTS_RCU_HEAD depends on PREEMPT, so #ifndef CONFIG_PREEMPT is totally useless in kernel/rcupdate.c.

By "useless" I meant the code under #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD, of course. :)

#2 lore raw
Quoted 6 lines · Cong Wang
Quoted 2 lines · Amerigo Wang

DEBUG_OBJECTS_RCU_HEAD depends on PREEMPT, so #ifndef CONFIG_PREEMPT is totally useless in kernel/rcupdate.c.

By "useless" I meant the code under #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD, of course. :)

Yep, I did interpret it that way. ;-)

Thanx, Paul

#3 lore raw
In reply to Amerigo Wang
Quoted 2 lines · Amerigo Wang

DEBUG_OBJECTS_RCU_HEAD depends on PREEMPT, so #ifndef CONFIG_PREEMPT is totally useless in kernel/rcupdate.c.

Queued, thank you, Amerigo!

I added a patch on top of this commenting why DEBUG_OBJECTS_RCU_HEAD is disallowed if !PREEMPT, FYI.

Thanx, Paul

Quoted 28 lines
Cc Paul E. McKenney <[email protected]>

---

kernel/rcupdate.c +0 -5
index a23a57a..afd21d1 100644
@@ -215,10 +215,6 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state)
 		 * If we detect that we are nested in a RCU read-side critical
 		 * section, we should simply fail, otherwise we would deadlock.
 		 */
-#ifndef CONFIG_PREEMPT
-		WARN_ON(1);
-		return 0;
-#else
 		if (rcu_preempt_depth() != 0 || preempt_count() != 0 ||
 		    irqs_disabled()) {
 			WARN_ON(1);
@@ -229,7 +225,6 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state)
 		rcu_barrier_bh();
 		debug_object_free(head, &rcuhead_debug_descr);
 		return 1;
-#endif
 	default:
 		return 0;
 	}