Re: [BUG?] memory hotplug: include/linux/radix-tree.h:145 invoked rcu_dereference_check() without protection!

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul E. McKenney
Date: Friday, December 17, 2010 - 9:01 am

On Fri, Dec 17, 2010 at 08:39:12AM +0000, Mel Gorman wrote:

Yes, if you have prevented updates from happening, then it is OK to
use rcu_dereference_protected() instead of rcu_dereference_check().

However, if RCU readers can invoke this code, things will break.

By the way, this means that something like:

	rcu_dereference_protected(p, rcu_read_lock_held()) /* BUGGY!!! */

is just plain wrong.


Yep, this is indeed the case that rcu_dereference_protected() is for.


Which should be optimized away during inlining, so no performance
penalty.  ;-)

							Thanx, Paul

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

Messages in current thread:
Re: [BUG?] [Ext4] INFO: suspicious rcu_dereference_check() ..., Paul E. McKenney, (Sun Nov 21, 11:16 pm)
Re: [BUG?] memory hotplug: include/linux/radix-tree.h:145 ..., KAMEZAWA Hiroyuki, (Tue Dec 7, 6:19 pm)
Re: [BUG?] memory hotplug: include/linux/radix-tree.h:145 ..., Paul E. McKenney, (Thu Dec 16, 10:47 pm)
Re: [BUG?] memory hotplug: include/linux/radix-tree.h:145 ..., Paul E. McKenney, (Fri Dec 17, 9:01 am)
Re: [BUG?] memory hotplug: include/linux/radix-tree.h:145 ..., Paul E. McKenney, (Fri Dec 17, 9:03 am)