Re: Sleeping in RCU list traversal

2007-10-07 Thread Tetsuo Handa
Hello. Peter Zijlstra wrote: > > So, I don't need to grab a reference to "ptr" > > because memory region pointed by "ptr" will never be kfree()ed. > > And it is legal to use "ptr" after rcu_read_unlock() > > because memory region pointed by "ptr" will never be kfree()ed. > > Still think that is a

Re: Sleeping in RCU list traversal

2007-10-07 Thread Peter Zijlstra
On Mon, 2007-10-08 at 01:56 +0900, Tetsuo Handa wrote: > So, I don't need to grab a reference to "ptr" > because memory region pointed by "ptr" will never be kfree()ed. > And it is legal to use "ptr" after rcu_read_unlock() > because memory region pointed by "ptr" will never be kfree()ed. Still

Re: Sleeping in RCU list traversal

2007-10-07 Thread Tetsuo Handa
Hello. Jun WANG wrote: > I'm sorry,I think I got your idea, if you do not need ptr in > my_task_that_may_sleep(), why you need to grab a reference to "ptr". If > your my_task_that_may_sleep() needs ptr, and according to the > "memory region pointed by "ptr" never be removed." you say, > it is ok

Re: Sleeping in RCU list traversal

2007-10-07 Thread Jun WANG
> Hello. > > Thank you for pointing out. > > Jun WANG wrote: > > >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(); > >

Re: Sleeping in RCU list traversal

2007-10-07 Thread Tetsuo Handa
Hello. Thank you for pointing out. Jun WANG wrote: > >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

Sleeping in RCU list traversal

2007-10-07 Thread Tetsuo Handa
Hello. Peter Zijlstra wrote: > > Can I sleep between rcu_read_lock() and rcu_read_unlock() ? > > As far as I saw, rcu_read_lock() makes in_atomic() true, so I think I can't > > sleep. > You can indeed not sleep in an rcu_read_lock() section. However, you > could grab a reference on an item, stop