[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180622062351.GC17010@X58A-UD3R>
Date: Fri, 22 Jun 2018 15:23:51 +0900
From: Byungchul Park <byungchul.park@....com>
To: jiangshanlai@...il.com, paulmck@...ux.vnet.ibm.com,
josh@...htriplett.org, rostedt@...dmis.org,
mathieu.desnoyers@...icios.com
Cc: linux-kernel@...r.kernel.org, kernel-team@....com,
joel@...lfernandes.org
Subject: Re: [PATCH] rcu: Refactor rcu_{nmi,irq}_{enter,exit}()
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 */
Powered by blists - more mailing lists