LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Breaks the redundant loop in kernel/marker.c
@ 2008-10-20  6:37 Zhaolei
  2008-10-20  6:52 ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Zhaolei @ 2008-10-20  6:37 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Mathieu Desnoyers, linux-kernel

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index 7d1faec..2c3172d 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -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);
-- 
1.5.5.3



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Breaks the redundant loop in kernel/marker.c
  2008-10-20  6:37 [PATCH] Breaks the redundant loop in kernel/marker.c Zhaolei
@ 2008-10-20  6:52 ` Ingo Molnar
  2008-10-20  7:17   ` Zhaolei
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2008-10-20  6:52 UTC (permalink / raw)
  To: Zhaolei; +Cc: Mathieu Desnoyers, linux-kernel


* Zhaolei <zhaolei@cn.fujitsu.com> wrote:

> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>  kernel/marker.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/marker.c b/kernel/marker.c
> index 7d1faec..2c3172d 100644
> --- a/kernel/marker.c
> +++ b/kernel/marker.c
> @@ -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);

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: [PATCH] Breaks the redundant loop in kernel/marker.c
  2008-10-20  6:52 ` Ingo Molnar
@ 2008-10-20  7:17   ` Zhaolei
  2008-10-20  7:25     ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Zhaolei @ 2008-10-20  7:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Mathieu Desnoyers, linux-kernel

Ingo Molnar wrote:
> 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.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index 7d1faec..2c3172d 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -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);
-- 
1.5.5.3



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: [PATCH] Breaks the redundant loop in kernel/marker.c
  2008-10-20  7:17   ` Zhaolei
@ 2008-10-20  7:25     ` Ingo Molnar
  2008-10-20 15:38       ` Mathieu Desnoyers
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2008-10-20  7:25 UTC (permalink / raw)
  To: Zhaolei; +Cc: Mathieu Desnoyers, linux-kernel


* Zhaolei <zhaolei@cn.fujitsu.com> wrote:

> Ingo Molnar wrote:
> > 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 <tglx@linutronix.de>
| 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Breaks the redundant loop in kernel/marker.c
  2008-10-20  7:25     ` Ingo Molnar
@ 2008-10-20 15:38       ` Mathieu Desnoyers
  2008-10-22  3:38         ` [PATCH v2] " Zhaolei
  0 siblings, 1 reply; 7+ messages in thread
From: Mathieu Desnoyers @ 2008-10-20 15:38 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Zhaolei, linux-kernel

* Ingo Molnar (mingo@elte.hu) wrote:
> 
> * Zhaolei <zhaolei@cn.fujitsu.com> wrote:
> 
> > Ingo Molnar wrote:
> > > 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 <tglx@linutronix.de>
> | 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

It looks all good with an extended changelog.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

Thanks,

Mathieu

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] Breaks the redundant loop in kernel/marker.c
  2008-10-20 15:38       ` Mathieu Desnoyers
@ 2008-10-22  3:38         ` Zhaolei
  2008-10-22  9:15           ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Zhaolei @ 2008-10-22  3:38 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: Ingo Molnar, linux-kernel

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

Impact: cleanup, no functionality changed

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 kernel/marker.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/kernel/marker.c b/kernel/marker.c
index e9c6b2b..8b5d253 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -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);
-- 
1.5.5.3




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Breaks the redundant loop in kernel/marker.c
  2008-10-22  3:38         ` [PATCH v2] " Zhaolei
@ 2008-10-22  9:15           ` Ingo Molnar
  0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2008-10-22  9:15 UTC (permalink / raw)
  To: Zhaolei; +Cc: Mathieu Desnoyers, linux-kernel


* Zhaolei <zhaolei@cn.fujitsu.com> wrote:

> Because e->name is unique in list, we don't need to continue the iteration
> after matched.
> 
> Impact: cleanup, no functionality changed
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>  kernel/marker.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)

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

	Ingo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-10-22  9:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-20  6:37 [PATCH] Breaks the redundant loop in kernel/marker.c Zhaolei
2008-10-20  6:52 ` Ingo Molnar
2008-10-20  7:17   ` Zhaolei
2008-10-20  7:25     ` Ingo Molnar
2008-10-20 15:38       ` Mathieu Desnoyers
2008-10-22  3:38         ` [PATCH v2] " Zhaolei
2008-10-22  9:15           ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).