Sleeping in RCU list traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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 the iteration, drop
> rcu_read_lock. Do you thing, re-acquire rcu_read_lock(), drop the ref,
> and continue the iteration.

Something like this?

  list_for_each_rcu(p, ...) {
    ptr = list_entry(p, struct ..., list);
    /* Grab a reference to "ptr". */
    /* Drop a reference to "ptr". */

Regarding my case, memory region pointed by "ptr" never be removed.
Do I need to grab a reference to "ptr" ?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at
Please read the FAQ at

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux