From: pengdonglin Since commit a8bb74acd8efe ("rcu: Consolidate RCU-sched update-side function definitions") there is no difference between rcu_read_lock(), rcu_read_lock_bh() and rcu_read_lock_sched() in terms of RCU read section and the relevant grace period. That means that spin_lock(), which implies rcu_read_lock_sched(), also implies rcu_read_lock(). There is no need no explicitly start a RCU read section if one has already been started implicitly by spin_lock(). Simplify the code and remove the inner rcu_read_lock() invocation. Cc: Taehee Yoo Cc: Andrew Lunn Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Signed-off-by: pengdonglin Signed-off-by: pengdonglin --- drivers/net/amt.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index ed86537b2f61..aaed9fbc7526 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -295,7 +295,6 @@ static void amt_source_work(struct work_struct *work) tunnel = gnode->tunnel_list; spin_lock_bh(&tunnel->lock); - rcu_read_lock(); if (gnode->filter_mode == MCAST_INCLUDE) { amt_destroy_source(snode); if (!gnode->nr_sources) @@ -306,7 +305,6 @@ static void amt_source_work(struct work_struct *work) */ snode->status = AMT_SOURCE_STATUS_D_FWD; } - rcu_read_unlock(); spin_unlock_bh(&tunnel->lock); } @@ -426,7 +424,6 @@ static void amt_group_work(struct work_struct *work) goto out; } - rcu_read_lock(); for (i = 0; i < buckets; i++) { hlist_for_each_entry_safe(snode, t, &gnode->sources[i], node) { @@ -443,7 +440,6 @@ static void amt_group_work(struct work_struct *work) amt_del_group(amt, gnode); else gnode->filter_mode = MCAST_INCLUDE; - rcu_read_unlock(); spin_unlock_bh(&tunnel->lock); out: dev_put(amt->dev); @@ -1327,11 +1323,9 @@ static void amt_clear_groups(struct amt_tunnel_list *tunnel) int i; spin_lock_bh(&tunnel->lock); - rcu_read_lock(); for (i = 0; i < amt->hash_buckets; i++) hlist_for_each_entry_safe(gnode, t, &tunnel->groups[i], node) amt_del_group(amt, gnode); - rcu_read_unlock(); spin_unlock_bh(&tunnel->lock); } @@ -1343,11 +1337,9 @@ static void amt_tunnel_expire(struct work_struct *work) struct amt_dev *amt = tunnel->amt; spin_lock_bh(&amt->lock); - rcu_read_lock(); list_del_rcu(&tunnel->list); amt->nr_tunnels--; amt_clear_groups(tunnel); - rcu_read_unlock(); spin_unlock_bh(&amt->lock); kfree_rcu(tunnel, rcu); } -- 2.34.1