Re: [PATCH 5/6] IMA: use rbtree instead of radix tree for inode information cache

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Wednesday, October 20, 2010 - 3:22 pm

On Wed, Oct 20, 2010 at 3:05 PM, Dave Chinner <david@fromorbit.com> wrote:

Look out for livelocks, though. And yes, they can happen.

So rather than a loop, one option is to do basically

  rcu_read_lock();
  seq = read_seqbegin();

  .. do lookup ..

  need_lock = read_seqretry(seq);
  rcu_read_unlock();

  if (need_lock) {
    get_real_lock();

    .. do lookup ..

    drop_real_lock();
 }

which just falls back to a locked access if the rcu model doesn't work.

                             Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 4/6] IMA: only allocate iint when needed, Eric Paris, (Tue Oct 19, 3:58 pm)
Re: [PATCH 5/6] IMA: use rbtree instead of radix tree for ..., Linus Torvalds, (Wed Oct 20, 3:22 pm)