Messages in this thread | | | Date | Sun, 11 Mar 2012 18:53:52 +0800 | From | Cong Wang <> | Subject | Re: [PATCH 1/2] module: use rcu to protect module list read |
| |
On 03/10/2012 11:25 PM, Eric Dumazet wrote: > Le samedi 10 mars 2012 à 22:20 +0800, Cong Wang a écrit : >> Now the read of module list is protected by preempt disable + *_rcu >> list operations, this is odd, as RCU read lock should be able to >> protect it directly. This patch makes the read of module list >> protected by RCU read lock and the write still protected by >> module_mutex. >> > > Problem is that your patch does more than that. > > In set_all_modules_text_rw() and set_all_modules_text_ro() you removed > the mutex in favor of rcu_read_lock()
Yeah, I was wrong, set_all_modules_text_rw() and set_all_modules_text_ro() mean to block module add/del, it is correct to use module_mutex.
> > Also, module code uses synchronize_sched(), not synchronize_rcu()
Stupid me, I totally missed this, should use rcu_read_lock_sched()...
> > Take a look at Documentation/RCU/whatisRCU.txt and see that > preempt_disable() / preempt_enable() are documented as a right protect > code, in line 333. > > You added races in /proc/modules as well.
Yeah, that list iteration is not protected by rcu yet.
> > So I would say your patch is not needed at all : module code already > uses RCU. > > What particular problem do you have with current code ?
preempt_disable() + list_*_rcu() looks a little weird for me, rcu_read_lock_sched() + list_*_rcu() is better, although they are functionally equal.
I will send out a new version.
Thanks for review! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |