Skip to contentSkip to conversation

Breaks the redundant loop in kernel/marker.c

PATCH Superseded Zhaolei 3 participants 7 messages Oct 20, 2008 – Oct 22, 2008

lore
Share & tools
lore

Zhaolei

author
#0 lore raw

PATCH 1/1 Breaks the redundant loop in kernel/marker.c

---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/marker.c +1 -2
index 7d1faec..2c3172d 100644
@@ -836,8 +836,6 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 			if (!e->ptype) {
 				if (num == 0 && e->single.func == probe)
 					return e->single.probe_private;
-				else
-					break;
 			} else {
 				struct marker_probe_closure *closure;
 				int match = 0;
@@ -849,6 +847,7 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 						return closure[i].probe_private;
 				}
 			}
+			break;
 		}
 	}
 	return ERR_PTR(-ENOENT);
Signature · 1 line
1.5.5.3
#1 lore raw
Quoted 19 lines · Zhaolei
---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/marker.c +0 -2
index 7d1faec..2c3172d 100644
@@ -836,8 +836,6 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 			if (!e->ptype) {
 				if (num == 0 && e->single.func == probe)
 					return e->single.probe_private;
-				else
-					break;
 			} else {
 				struct marker_probe_closure *closure;
 				int match = 0;

kernel/marker.c void *marker_get_private_data(const char *name, marker_probe_func *probe, · line 853

Quoted 7 lines
kernel/marker.c +1 -0
@@ -849,6 +847,7 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 						return closure[i].probe_private;
 				}
 			}
+			break;
 		}
 	}
 	return ERR_PTR(-ENOENT);

hm, could you describe the necessity of this patch some more? This has the change to change behavior, which might even be a bugfix: is there any chance that the closure-loop in the e->ptype != NULL branch does not exit? Before your patch we'd continue the iteration - which _probably_ does not lead to any more matches (e->name is supposed to be unique).

Ingo

author
#2 lore raw
Quoted 5 lines · Ingo Molnar

hm, could you describe the necessity of this patch some more? This has the change to change behavior, which might even be a bugfix: is there any chance that the closure-loop in the e->ptype != NULL branch does not exit? Before your patch we'd continue the iteration - which _probably_ does not lead to any more matches (e->name is supposed to be unique).

Because e->name is unique in list, we don't need to continue the iteration after matched.
This is a cleanup.

---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/marker.c +1 -2
index 7d1faec..2c3172d 100644
@@ -836,8 +836,6 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 			if (!e->ptype) {
 				if (num == 0 && e->single.func == probe)
 					return e->single.probe_private;
-				else
-					break;
 			} else {
 				struct marker_probe_closure *closure;
 				int match = 0;
@@ -849,6 +847,7 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 						return closure[i].probe_private;
 				}
 			}
+			break;
 		}
 	}
 	return ERR_PTR(-ENOENT);
Signature · 1 line
1.5.5.3
#3 lore raw
Quoted 10 lines · Zhaolei
Quoted 5 lines · Ingo Molnar

hm, could you describe the necessity of this patch some more? This has the change to change behavior, which might even be a bugfix: is there any chance that the closure-loop in the e->ptype != NULL branch does not exit? Before your patch we'd continue the iteration - which _probably_ does not lead to any more matches (e->name is supposed to be unique).

Because e->name is unique in list, we don't need to continue the iteration after matched.
This is a cleanup.

ok - it's useful to point this out in the changelog. You can use the "Impact:" header we started using recently:

Impact: cleanup, no functionality changed

See for example this upstream commit:

| commit 07454bfff151d2465ada809bbaddf3548cc1097c
| Author: Thomas Gleixner <[email protected]>
| Date:   Sat Oct 4 10:51:07 2008 +0200
|
|     clockevents: check broadcast tick device not the clock events device
|
|     Impact: jiffies increment too fast.

Mathieu, any objections against the patch?

Ingo

#4 lore raw
Quoted 29 lines · * Ingo Molnar ([email protected]) wrote:
Quoted 10 lines · Zhaolei
Quoted 5 lines · Ingo Molnar

hm, could you describe the necessity of this patch some more? This has the change to change behavior, which might even be a bugfix: is there any chance that the closure-loop in the e->ptype != NULL branch does not exit? Before your patch we'd continue the iteration - which _probably_ does not lead to any more matches (e->name is supposed to be unique).

Because e->name is unique in list, we don't need to continue the iteration after matched.
This is a cleanup.

ok - it's useful to point this out in the changelog. You can use the "Impact:" header we started using recently:

Impact: cleanup, no functionality changed

See for example this upstream commit:

| commit 07454bfff151d2465ada809bbaddf3548cc1097c
| Author: Thomas Gleixner <[email protected]>
| Date:   Sat Oct 4 10:51:07 2008 +0200
|
|     clockevents: check broadcast tick device not the clock events device
|
|     Impact: jiffies increment too fast.
Quoted 3 lines

Mathieu, any objections against the patch?

Ingo

It looks all good with an extended changelog.

Thanks,

Mathieu

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
author
#5 lore raw

PATCH v2 1/1 Breaks the redundant loop in kernel/marker.c

Because e->name is unique in list, we don't need to continue the iteration after matched.

Impact: cleanup, no functionality changed

---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/marker.c +1 -2
index e9c6b2b..8b5d253 100644
@@ -848,8 +848,6 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 			if (!e->ptype) {
 				if (num == 0 && e->single.func == probe)
 					return e->single.probe_private;
-				else
-					break;
 			} else {
 				struct marker_probe_closure *closure;
 				int match = 0;
@@ -861,6 +859,7 @@ void *marker_get_private_data(const char *name, marker_probe_func *probe,
 						return closure[i].probe_private;
 				}
 			}
+			break;
 		}
 	}
 	return ERR_PTR(-ENOENT);
Signature · 1 line
1.5.5.3
Applied
#6 lore raw
Quoted 9 lines · Zhaolei

Because e->name is unique in list, we don't need to continue the iteration after matched.

Impact: cleanup, no functionality changed

---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

applied to tip/tracing/markers, thanks! (also added Mathieu's ack)

Ingo