On Fri, Jun 22, 2018 at 03:12:06PM +0900, Byungchul Park wrote:
> When passing through irq or NMI contexts, the current code uses
> ->dynticks_nmi_nesting to detect if it's in the ourmost at the moment.
> 
> Here, the thing is that all the related functions, rcu_irq_enter(),
> rcu_nmi_enter(), rcu_irq_exit() and rcu_nmi_exit() are carrying out
> the check within each under the following call relationship so there
> must be redundant conditional branches:
> 
>    rcu_irq_enter()
>       /* A conditional branch with ->dynticks_nmi_nesting */
>       rcu_nmi_enter()
>          /* A conditional branch with ->dynticks_nmi_nesting */
                                               ^
                                  Precisely, ->dynticks
>       /* A conditional branch with ->dynticks_nmi_nesting */
> 
>    rcu_irq_exit()
>       /* A conditional branch with ->dynticks_nmi_nesting */
>       rcu_nmi_exit()
>          /* A conditional branch with ->dynticks_nmi_nesting */
>       /* A conditional branch with ->dynticks_nmi_nesting */
> 
>    rcu_nmi_enter()
>       /* A conditional branch with ->dynticks_nmi_nesting */
                                               ^
                                  Precisely, ->dynticks
> 
>    rcu_nmi_exit()
>       /* A conditional branch with ->dynticks_nmi_nesting */
> 
> In order to make the code more readable and remove redundant
> conditional branches, we need to refactor rcu_{nmi,irq}_{enter,exit}()
> so they use a common function for each like:
> 
>    rcu_irq_enter() inlining rcu_nmi_enter_common(irq)
>       /* A conditional branch with ->dynticks_nmi_nesting */
                                               ^
                                  Precisely, ->dynticks
> 
>    rcu_irq_exit() inlining rcu_nmi_exit_common(irq)
>       /* A conditional branch with ->dynticks_nmi_nesting */
> 
>    rcu_nmi_enter() inlining rcu_nmi_enter_common(nmi)
>       /* A conditional branch with ->dynticks_nmi_nesting */
                                               ^
                                  Precisely, ->dynticks
> 
>    rcu_nmi_exit() inlining rcu_nmi_exit_common(nmi)
>       /* A conditional branch with ->dynticks_nmi_nesting */

Reply via email to