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: Peter Zijlstra
Date: Wednesday, October 20, 2010 - 4:31 am

On Wed, 2010-10-20 at 10:17 +1100, Dave Chinner wrote:

Correct, what can be made to work is combine RCU with a seqlock. Retry
the lookup using read_seqretry(), RCU here helps to ensure you're not
stepping on already freed memory.


So, tree modification does:

  write_seqlock();
  /* frob RB-tree, using call_rcu() for frees where needed */
  write_sequnlock();

Lookup does:

  unsigned seq;

  rcu_read_lock()
again;
  seq = read_seqbegin();

  /* RB-tree lookup */

  if (read_seqretry(seq))
    goto again;

  rcu_read_unlock();

  return obj;
  


--
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 ..., Peter Zijlstra, (Wed Oct 20, 4:31 am)