Skip to contentSkip to conversation

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

PATCH Applied Steven Rostedt 2 participants 2 messages Feb 6, 2017 – Feb 7, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Place "not" inside of unlikely() statement in wb_domain_writeout_inc()

From: "Steven Rostedt (VMware)" <[email protected]>

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.

---
 mm/page-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page-writeback.c +1 -1
index 290e8b7..94102c7 100644
@@ -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
Signature · 1 line
2.9.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

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.

Yeah, good catch. You can add:

Andrew, will you merge this patch please? Thanks!

Honza

Quoted 20 lines
---
 mm/page-writeback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page-writeback.c +1 -1
index 290e8b7..94102c7 100644
@@ -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
Signature · 1 line
2.9.3
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR