Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575005 > unrolled thread

[PATCH] mm: Place "not" inside of unlikely() statement in wb_domain_writeout_inc()

Started bySteven Rostedt <rostedt@goodmis.org>
First post2017-02-06 18:10 +0100
Last post2017-02-07 15:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm: Place "not" inside of unlikely() statement in  wb_domain_writeout_inc() Steven Rostedt <rostedt@goodmis.org> - 2017-02-06 18:10 +0100
    Re: [PATCH] mm: Place "not" inside of unlikely() statement in  wb_domain_writeout_inc() Jan Kara <jack@suse.cz> - 2017-02-07 15:40 +0100

#1575005 — [PATCH] mm: Place "not" inside of unlikely() statement in wb_domain_writeout_inc()

FromSteven Rostedt <rostedt@goodmis.org>
Date2017-02-06 18:10 +0100
Subject[PATCH] mm: Place "not" inside of unlikely() statement in wb_domain_writeout_inc()
Message-ID<t7UXE-7LS-37@gated-at.bofh.it>
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The likely/unlikely profiler noticed that the unlikely statement in
wb_domain_writeout_inc() is constantly wrong. This is due to the "not" (!)
being outside the unlikely statement. It is likely that dom->period_time
will be set, but unlikely that it wont be. Move the not into the unlikely
statement.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 mm/page-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 290e8b7..94102c7 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -580,7 +580,7 @@ static void wb_domain_writeout_inc(struct wb_domain *dom,
 	__fprop_inc_percpu_max(&dom->completions, completions,
 			       max_prop_frac);
 	/* First event after period switching was turned off? */
-	if (!unlikely(dom->period_time)) {
+	if (unlikely(!dom->period_time)) {
 		/*
 		 * We can race with other __bdi_writeout_inc calls here but
 		 * it does not cause any harm since the resulting time when
-- 
2.9.3

[toc] | [next] | [standalone]


#1575773

FromJan Kara <jack@suse.cz>
Date2017-02-07 15:40 +0100
Message-ID<t8f62-45q-15@gated-at.bofh.it>
In reply to#1575005
On Mon 06-02-17 12:00:35, Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> The likely/unlikely profiler noticed that the unlikely statement in
> wb_domain_writeout_inc() is constantly wrong. This is due to the "not" (!)
> being outside the unlikely statement. It is likely that dom->period_time
> will be set, but unlikely that it wont be. Move the not into the unlikely
> statement.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Yeah, good catch. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

Andrew, will you merge this patch please? Thanks!

								Honza

> ---
>  mm/page-writeback.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 290e8b7..94102c7 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -580,7 +580,7 @@ static void wb_domain_writeout_inc(struct wb_domain *dom,
>  	__fprop_inc_percpu_max(&dom->completions, completions,
>  			       max_prop_frac);
>  	/* First event after period switching was turned off? */
> -	if (!unlikely(dom->period_time)) {
> +	if (unlikely(!dom->period_time)) {
>  		/*
>  		 * We can race with other __bdi_writeout_inc calls here but
>  		 * it does not cause any harm since the resulting time when
> -- 
> 2.9.3
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web