public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Urs Thuermann <urs@isnogud.escape.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Q: locking mechanisms
Date: Tue, 4 Jul 2006 23:11:26 -0700	[thread overview]
Message-ID: <20060705061126.GA20483@us.ibm.com> (raw)
In-Reply-To: <m2mzbpcyrh.fsf@janus.isnogud.escape.de>

On Tue, Jul 04, 2006 at 02:58:42PM +0200, Urs Thuermann wrote:
> Thomas Gleixner <tglx@linutronix.de> writes:
> 
> > Does Documentation/listRCU.txt answer your questions ?
> 
> It doesn't answer my question.  I have code that receives network
> packets by registering with dev_add_pack().  Each packet received is
> then delivered to a list of receivers, where this list can contain quite
> a lot of items:
> 
> 	receive_function(struct sk_buff *skb, struct net_device *dev,
> 			struct packet_type *pt, struct net_device *orig_dev)
> 	{
> 		...
> 		rcu_read_lock();
>                 head = find_list(dev);
> 		hlist_for_each_entry_rcu(p, n, head, list) {
> 			deliver_packet_to_receiver(skb, p);
> 		}
> 		rcu_read_unlock();
> 	}
> 
> The deliver_packet_to_receiver() function finally ends up in a call to
> sock_queue_rcv_skb().
> 
> My questions was, wether I should worry to "hold" the rcu_read_lock for
> the time of the list traversal since the list can be quite long and
> preemption is disabled between rcu_read_lock() and rcu_read_unlock().

"Holding" rcu_read_lock() for long time periods is much less of a
concern than holding other types of synchronization mechanisms.
The main concern is the effect on realtime latency in CONFIG_PREEMPT
(but -not- CONFIG_PREEMPT_RT) kernels.  This concern is due to the
fact that rcu_read_lock() suppresses preemption in CONFIG_PREEMPT
kernels.

But I have to ask: roughly how long is "quite long"?

							Thanx, Paul

  reply	other threads:[~2006-07-05  6:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-01  5:58 Q: locking mechanisms Urs Thuermann
2006-07-01  9:36 ` Thomas Gleixner
2006-07-02  5:26   ` Urs Thuermann
2006-07-04 12:58   ` Urs Thuermann
2006-07-05  6:11     ` Paul E. McKenney [this message]
2006-07-05  9:35       ` Urs Thuermann
2006-07-05 14:13         ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060705061126.GA20483@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=urs@isnogud.escape.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox