linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: anish singh <anish198519851985@gmail.com>
Cc: 韩磊 <bonben1989@gmail.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: list_head and lock?
Date: Mon, 18 Nov 2013 14:58:41 -0800	[thread overview]
Message-ID: <20131118225841.GI4138@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAK7N6vpL+zXrb+2uoT3=kggAin34k+FkB-bt1_Sgw17uC5MkLQ@mail.gmail.com>

On Sun, Nov 17, 2013 at 05:48:14PM -0800, anish singh wrote:
> On Sun, Nov 17, 2013 at 5:19 PM, 韩磊 <bonben1989@gmail.com> wrote:
> > when we delete,add,search,amend the list_head,should we use spinlock
> > or rcu in case of conflicit to list_head???
> There is no implicit locking when we use 'list' api's.You should explicitly
> do that AFAIK.

See Documentation/RCU/listRCU.txt for a summary of how to use RCU-protected
linked lists.  But yes, readers need to explicitly do rcu_read_lock()
and rcu_read_unlock(), and updaters must coordinate with each others
somehow, for example, explicitly using spinlocks.

The list_head macros are about list manipulation and not so much about
synchronization.

							Thanx, Paul


      reply	other threads:[~2013-11-18 22:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18  1:19 list_head and lock? 韩磊
2013-11-18  1:48 ` anish singh
2013-11-18 22:58   ` Paul E. McKenney [this message]

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=20131118225841.GI4138@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=anish198519851985@gmail.com \
    --cc=bonben1989@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).