public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re:Sleeping in RCU list traversal
@ 2007-10-07 19:11 Jun WANG
  2007-10-07 13:26 ` Sleeping " Tetsuo Handa
  0 siblings, 1 reply; 7+ messages in thread
From: Jun WANG @ 2007-10-07 19:11 UTC (permalink / raw)
  To: penguin-kernel; +Cc: linux-kernel

Hi
>Something like this?
>
>rcu_read_lock();
>list_for_each_rcu(p, ...) {
>   ptr = list_entry(p, struct ..., list);
>   /* Grab a reference to "ptr". */
>   rcu_read_unlock();
>   my_task_that_may_sleep(ptr);
>   rcu_read_lock();
>   /* Drop a reference to "ptr". */
 >}
 >rcu_read_unlock();

>Regarding my case, memory region pointed by "ptr" never be removed.
>Do I need to grab a reference to "ptr" ?
In Document/RCU/whatisRCU.txt
Note that the value returned by rcu_dereference() is valid
	only within the enclosing RCU read-side critical section.
	For example, the following is -not- legal:

		rcu_read_lock();
		p = rcu_dereference(head.next);
		rcu_read_unlock();
		x = p->address;
		rcu_read_lock();
		y = p->data;
		rcu_read_unlock();

	Holding a reference from one RCU read-side critical section
	to another is just as illegal as holding a reference from
	one lock-based critical section to another!  Similarly,
	using a reference outside of the critical section in which
	it was acquired is just as illegal as doing so with normal
	locking.
                                                            Jun Wang


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [TOMOYO 05/15](repost) Domain transition handler functions.
@ 2007-10-03 12:37 James Morris
  2007-10-03 13:04 ` Tetsuo Handa
  0 siblings, 1 reply; 7+ messages in thread
From: James Morris @ 2007-10-03 12:37 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明
  Cc: penguin-kernel, linux-kernel, linux-security-module, chrisw

[-- Attachment #1: Type: TEXT/PLAIN, Size: 577 bytes --]

On Wed, 3 Oct 2007, YOSHIFUJI Hideaki / µÈÆ£±ÑÌÀ wrote:

> In article <200710032024.DJF78662.FHOLtMSFOOFJVQ@I-love.SAKURA.ne.jp> (at Wed, 3 Oct 2007 20:24:52 +0900), Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> says:
> 
> > It seems that standard kernel list API does not have singly-linked list manipulation.
> > I'm considering the following list manipulation API.
> 
> Tstsuo, please name it "slist", which is well-known.

I'm pretty sure that the singly linked list idea has been rejected a few 
times.  Just use the existing API.

-- 
James Morris
<jmorris@namei.org>

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

end of thread, other threads:[~2007-10-07 19:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-07 19:11 Re:Sleeping in RCU list traversal Jun WANG
2007-10-07 13:26 ` Sleeping " Tetsuo Handa
2007-10-07 22:37   ` Jun WANG
2007-10-07 16:56     ` Tetsuo Handa
2007-10-07 18:33       ` Peter Zijlstra
2007-10-07 19:56         ` Tetsuo Handa
  -- strict thread matches above, loose matches on Subject: below --
2007-10-03 12:37 [TOMOYO 05/15](repost) Domain transition handler functions James Morris
2007-10-03 13:04 ` Tetsuo Handa
2007-10-03 13:14   ` KaiGai Kohei
2007-10-03 13:59     ` Tetsuo Handa
2007-10-03 14:07       ` Peter Zijlstra
2007-10-07 10:38         ` Sleeping in RCU list traversal Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox