linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* list_head and lock?
@ 2013-11-18  1:19 韩磊
  2013-11-18  1:48 ` anish singh
  0 siblings, 1 reply; 3+ messages in thread
From: 韩磊 @ 2013-11-18  1:19 UTC (permalink / raw)
  To: Linux Kernel Mailing List

when we delete,add,search,amend the list_head,should we use spinlock
or rcu in case of conflicit to list_head???

Thank you!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: list_head and lock?
  2013-11-18  1:19 list_head and lock? 韩磊
@ 2013-11-18  1:48 ` anish singh
  2013-11-18 22:58   ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: anish singh @ 2013-11-18  1:48 UTC (permalink / raw)
  To: 韩磊; +Cc: Linux Kernel Mailing List

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.
>
> Thank you!
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: list_head and lock?
  2013-11-18  1:48 ` anish singh
@ 2013-11-18 22:58   ` Paul E. McKenney
  0 siblings, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2013-11-18 22:58 UTC (permalink / raw)
  To: anish singh; +Cc: 韩磊, Linux Kernel Mailing List

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-18 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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).