Peter Zijlstra <pet...@infradead.org> writes:
> Currently the RCU usage in module is an inconsistent mess of RCU and
> RCU-sched, this is broken for CONFIG_PREEMPT where synchronize_rcu()
> does not imply synchronize_sched().

Huh?  It's not "an inconsistent mess".  They're all synchronize_rcu(),
except one.

That one is *specifically* a best effort bandaid for the case where
module initialization has failed.  It's theoretically racy, so we wait a
bit before freeing.

That said, I love the new checks, thanks!

> +static inline void module_assert_mutex(void)
> +{
> +     lockdep_assert_held(&module_mutex);
> +}
> +
> +static inline void module_assert_mutex_or_preempt(void)
> +{
> +#ifdef CONFIG_LOCKDEP
> +     int rcu_held = rcu_read_lock_sched_held();
> +     int mutex_held = 1;
> +
> +     if (debug_locks)
> +             mutex_held = lockdep_is_held(&module_mutex);
> +
> +     WARN_ON(!rcu_held && !mutex_held);
> +#endif
> +}

Minor nitpick: I generally avoid static inline in C files (unless
functions are unused under some config options, which these aren't).

In general, they mess up future cleanups, as gcc doesn't warn about
unused functions.

Thanks,
Rusty.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to