On Sat, Oct 05, 2013 at 07:17:46PM +0200, Oleg Nesterov wrote:
> To me the annoying part is that this patch exports rcu_sync_ops*.
> We can add "enum rcu_sync_type rcu_sync_struct->gp_type" instead,
> see the patch below. But then the next "add the CONFIG_PROVE_RCU
> checks" needs to uninline rcu_sync_is_idle() for CONFIG_PROVE_RCU.
> 
> Or do you still think we should do something else?

> @@ -44,7 +45,7 @@ void rcu_sync_enter(struct rcu_sync_struct *rss)
>       BUG_ON(need_wait && need_sync);
>  
>       if (need_sync) {
> -             rss->sync();
> +             gp_ops[rss->gp_type].sync();
>               rss->gp_state = GP_PASSED;
>               wake_up_all(&rss->gp_wait);
>       } else if (need_wait) {
> @@ -81,7 +82,7 @@ static void rcu_sync_func(struct rcu_head *rcu)
>                * to catch a later GP.
>                */
>               rss->cb_state = CB_PENDING;
> -             rss->call(&rss->cb_head, rcu_sync_func);
> +             gp_ops[rss->gp_type].call(&rss->cb_head, rcu_sync_func);
>       } else {
>               /*
>                * We're at least a GP after rcu_sync_exit(); eveybody will now
> @@ -99,7 +100,7 @@ void rcu_sync_exit(struct rcu_sync_struct *rss)
>       if (!--rss->gp_count) {
>               if (rss->cb_state == CB_IDLE) {
>                       rss->cb_state = CB_PENDING;
> -                     rss->call(&rss->cb_head, rcu_sync_func);
> +                     gp_ops[rss->gp_type].call(&rss->cb_head, rcu_sync_func);
>               } else if (rss->cb_state == CB_PENDING) {
>                       rss->cb_state = CB_REPLAY;
>               }
> 

I think Linus meant to have rcu_sync_{enter,exit} as inlines with a
const enum argument for the gp_type.

That said; yes that will generate better code, but also more code, and
like Steven already argued performance isn't really an issue here since
we're going to potentially sleep for a rather long time.


--
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