From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH 1/2] sched: Add cond_resched_rcu_lock() helper Date: Fri, 26 Apr 2013 08:13:59 +0200 Message-ID: <20130426061359.GA25912@gmail.com> References: <1366940708-10180-1-git-send-email-horms@verge.net.au> <1366940708-10180-2-git-send-email-horms@verge.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Dumazet , Julian Anastasov , Ingo Molnar , Peter Zijlstra , lvs-devel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Pablo Neira Ayuso , Dipankar Sarma , "Paul E. McKenney" To: Simon Horman Return-path: Content-Disposition: inline In-Reply-To: <1366940708-10180-2-git-send-email-horms@verge.net.au> Sender: netdev-owner@vger.kernel.org List-Id: netfilter-devel.vger.kernel.org * Simon Horman wrote: > This is intended for use in loops which read data protected by RCU and may > have a large number of iterations. Such an example is dumping the list of > connections known to IPVS: ip_vs_conn_array() and ip_vs_conn_seq_next(). > > As suggested by Eric Dumazet. > > Cc: Eric Dumazet > Cc: Julian Anastasov > Signed-off-by: Simon Horman > --- > include/linux/sched.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index e692a02..7eec4c7 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -2787,3 +2787,12 @@ static inline unsigned long rlimit_max(unsigned int limit) > } > > #endif > + > +static void inline cond_resched_rcu_lock(void) > +{ > + if (need_resched()) { > + rcu_read_unlock(); > + cond_resched(); > + rcu_read_lock(); > + } > +} Acked-by: Ingo Molnar Ingo