Re: [PATCH] rcu: Remove debug_object_active_state() from debug_rcu_head_queue/unqueue()

From: Paul E. McKenney
Date: Thu May 12 2022 - 20:50:03 EST


On Tue, May 10, 2022 at 11:07:48AM +0800, Zqiang wrote:
> Currently, the double call_rcu() detected only need call
> debug_object_activate() to check whether the rcu head object is
> activated, the rcu head object usage state check is not necessary
> and when call rcu_test_debug_objects() the debug_object_active_state()
> will output same callstack as debug_object_activate(). so remove
> debug_object_active_state() to reduce the output of repeated callstack.
>
> Signed-off-by: Zqiang <qiang1.zhang@xxxxxxxxx>

Could you please post the output of the dmesg output of a failed
check with your change?

Thanx, Paul

> ---
> kernel/rcu/rcu.h | 13 +------------
> 1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
> index 15b96f990774..0604ecd16627 100644
> --- a/kernel/rcu/rcu.h
> +++ b/kernel/rcu/rcu.h
> @@ -179,27 +179,16 @@ static inline unsigned long rcu_seq_diff(unsigned long new, unsigned long old)
> */
>
> #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
> -# define STATE_RCU_HEAD_READY 0
> -# define STATE_RCU_HEAD_QUEUED 1
>
> extern const struct debug_obj_descr rcuhead_debug_descr;
>
> static inline int debug_rcu_head_queue(struct rcu_head *head)
> {
> - int r1;
> -
> - r1 = debug_object_activate(head, &rcuhead_debug_descr);
> - debug_object_active_state(head, &rcuhead_debug_descr,
> - STATE_RCU_HEAD_READY,
> - STATE_RCU_HEAD_QUEUED);
> - return r1;
> + return debug_object_activate(head, &rcuhead_debug_descr);
> }
>
> static inline void debug_rcu_head_unqueue(struct rcu_head *head)
> {
> - debug_object_active_state(head, &rcuhead_debug_descr,
> - STATE_RCU_HEAD_QUEUED,
> - STATE_RCU_HEAD_READY);
> debug_object_deactivate(head, &rcuhead_debug_descr);
> }
> #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
> --
> 2.25.1
>