LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[PATCH v3 2/2] ipvs: Use cond_resched_rcu_lock() helper when dumping con

To: Eric Dumazet <eric.dumazet@xxxxxxxxx>, Julian Anastasov <ja@xxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
Subject: [PATCH v3 2/2] ipvs: Use cond_resched_rcu_lock() helper when dumping connections
Cc: lvs-devel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>, Dipankar Sarma <dipankar@xxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Wed, 1 May 2013 17:57:53 +0900
This avoids the situation where a dump of a large number of connections
may prevent scheduling for a long time while also avoiding excessive
calls to rcu_read_unlock() and rcu_read_lock().

Note that in the case of !CONFIG_PREEMPT_RCU this will
add a call to cond_resched().

Compile tested only.

Cc: Eric Dumazet <eric.dumazet@xxxxxxxxx>
Cc: Julian Anastasov <ja@xxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
 net/netfilter/ipvs/ip_vs_conn.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index a083bda..42a7b33 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -975,8 +975,7 @@ static void *ip_vs_conn_array(struct seq_file *seq, loff_t 
pos)
                                return cp;
                        }
                }
-               rcu_read_unlock();
-               rcu_read_lock();
+               cond_resched_rcu_lock();
        }
 
        return NULL;
@@ -1015,8 +1014,7 @@ static void *ip_vs_conn_seq_next(struct seq_file *seq, 
void *v, loff_t *pos)
                        iter->l = &ip_vs_conn_tab[idx];
                        return cp;
                }
-               rcu_read_unlock();
-               rcu_read_lock();
+               cond_resched_rcu_lock();
        }
        iter->l = NULL;
        return NULL;
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>