linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [perf] Account the nr_entries in rblist properly
@ 2012-08-31  7:09 Suzuki K. Poulose
  2012-08-31 16:23 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Suzuki K. Poulose @ 2012-08-31  7:09 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Suzuki K. Poulose, David S. Ahern

The nr_entries in rblist is never decremented when an element
is deleted. Also, use rblist__remove_node to delete a node in
rblist__delete(). This would keep the nr_entries sane.

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: David S. Ahern <dsahern@gmail.com>
---

 tools/perf/util/rblist.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/rblist.c b/tools/perf/util/rblist.c
index 0171fb6..a16cdd2 100644
--- a/tools/perf/util/rblist.c
+++ b/tools/perf/util/rblist.c
@@ -44,6 +44,7 @@ int rblist__add_node(struct rblist *rblist, const void *new_entry)
 void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node)
 {
 	rb_erase(rb_node, &rblist->entries);
+	--rblist->nr_entries;
 	rblist->node_delete(rblist, rb_node);
 }
 
@@ -87,8 +88,7 @@ void rblist__delete(struct rblist *rblist)
 		while (next) {
 			pos = next;
 			next = rb_next(pos);
-			rb_erase(pos, &rblist->entries);
-			rblist->node_delete(rblist, pos);
+			rblist__remove_node(rblist, pos);
 		}
 		free(rblist);
 	}


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

* Re: [PATCH] [perf] Account the nr_entries in rblist properly
  2012-08-31  7:09 [PATCH] [perf] Account the nr_entries in rblist properly Suzuki K. Poulose
@ 2012-08-31 16:23 ` David Ahern
  2012-10-17 17:38 ` David Ahern
  2012-10-25  8:00 ` [tip:perf/core] " tip-bot for Suzuki K. Poulose
  2 siblings, 0 replies; 5+ messages in thread
From: David Ahern @ 2012-08-31 16:23 UTC (permalink / raw)
  To: Suzuki K. Poulose, Arnaldo Carvalho de Melo; +Cc: linux-kernel

On 8/31/12 1:09 AM, Suzuki K. Poulose wrote:
> The nr_entries in rblist is never decremented when an element
> is deleted. Also, use rblist__remove_node to delete a node in
> rblist__delete(). This would keep the nr_entries sane.
>
> Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
> Cc: David S. Ahern <dsahern@gmail.com>
> ---
>
>   tools/perf/util/rblist.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/rblist.c b/tools/perf/util/rblist.c
> index 0171fb6..a16cdd2 100644
> --- a/tools/perf/util/rblist.c
> +++ b/tools/perf/util/rblist.c
> @@ -44,6 +44,7 @@ int rblist__add_node(struct rblist *rblist, const void *new_entry)
>   void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node)
>   {
>   	rb_erase(rb_node, &rblist->entries);
> +	--rblist->nr_entries;
>   	rblist->node_delete(rblist, rb_node);
>   }

nice catch.

>
> @@ -87,8 +88,7 @@ void rblist__delete(struct rblist *rblist)
>   		while (next) {
>   			pos = next;
>   			next = rb_next(pos);
> -			rb_erase(pos, &rblist->entries);
> -			rblist->node_delete(rblist, pos);
> +			rblist__remove_node(rblist, pos);
>   		}
>   		free(rblist);
>   	}

Acked-by: David Ahern <dsahern@gmail.com>


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

* Re: [PATCH] [perf] Account the nr_entries in rblist properly
  2012-08-31  7:09 [PATCH] [perf] Account the nr_entries in rblist properly Suzuki K. Poulose
  2012-08-31 16:23 ` David Ahern
@ 2012-10-17 17:38 ` David Ahern
  2012-10-17 17:53   ` Arnaldo Carvalho de Melo
  2012-10-25  8:00 ` [tip:perf/core] " tip-bot for Suzuki K. Poulose
  2 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2012-10-17 17:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Suzuki K. Poulose, linux-kernel

Arnaldo:

I think this one has fallen through the cracks.


On 8/31/12 1:09 AM, Suzuki K. Poulose wrote:
> The nr_entries in rblist is never decremented when an element
> is deleted. Also, use rblist__remove_node to delete a node in
> rblist__delete(). This would keep the nr_entries sane.
>
> Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
> Cc: David S. Ahern <dsahern@gmail.com>
> ---
>
>   tools/perf/util/rblist.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/rblist.c b/tools/perf/util/rblist.c
> index 0171fb6..a16cdd2 100644
> --- a/tools/perf/util/rblist.c
> +++ b/tools/perf/util/rblist.c
> @@ -44,6 +44,7 @@ int rblist__add_node(struct rblist *rblist, const void *new_entry)
>   void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node)
>   {
>   	rb_erase(rb_node, &rblist->entries);
> +	--rblist->nr_entries;
>   	rblist->node_delete(rblist, rb_node);
>   }
>
> @@ -87,8 +88,7 @@ void rblist__delete(struct rblist *rblist)
>   		while (next) {
>   			pos = next;
>   			next = rb_next(pos);
> -			rb_erase(pos, &rblist->entries);
> -			rblist->node_delete(rblist, pos);
> +			rblist__remove_node(rblist, pos);
>   		}
>   		free(rblist);
>   	}
>


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

* Re: [PATCH] [perf] Account the nr_entries in rblist properly
  2012-10-17 17:38 ` David Ahern
@ 2012-10-17 17:53   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-17 17:53 UTC (permalink / raw)
  To: David Ahern; +Cc: Suzuki K. Poulose, linux-kernel

Em Wed, Oct 17, 2012 at 11:38:58AM -0600, David Ahern escreveu:
> Arnaldo:
> 
> I think this one has fallen through the cracks.

Thanks for catching this, applied to perf/core.

- Arnaldo

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

* [tip:perf/core] Account the nr_entries in rblist properly
  2012-08-31  7:09 [PATCH] [perf] Account the nr_entries in rblist properly Suzuki K. Poulose
  2012-08-31 16:23 ` David Ahern
  2012-10-17 17:38 ` David Ahern
@ 2012-10-25  8:00 ` tip-bot for Suzuki K. Poulose
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Suzuki K. Poulose @ 2012-10-25  8:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: acme, linux-kernel, hpa, mingo, suzuki, dsahern, tglx

Commit-ID:  03f2f93ae00762eb881424df1c688d034fd341ee
Gitweb:     http://git.kernel.org/tip/03f2f93ae00762eb881424df1c688d034fd341ee
Author:     Suzuki K. Poulose <suzuki@in.ibm.com>
AuthorDate: Fri, 31 Aug 2012 12:39:18 +0530
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 24 Oct 2012 14:20:11 -0200

Account the nr_entries in rblist properly

The nr_entries in rblist is never decremented when an element
is deleted. Also, use rblist__remove_node to delete a node in
rblist__delete(). This would keep the nr_entries sane.

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Acked-by: David S. Ahern <dsahern@gmail.com>
Cc: David S. Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/20120831070834.14806.87398.stgit@suzukikp.in.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/rblist.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/rblist.c b/tools/perf/util/rblist.c
index 0171fb6..a16cdd2 100644
--- a/tools/perf/util/rblist.c
+++ b/tools/perf/util/rblist.c
@@ -44,6 +44,7 @@ int rblist__add_node(struct rblist *rblist, const void *new_entry)
 void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node)
 {
 	rb_erase(rb_node, &rblist->entries);
+	--rblist->nr_entries;
 	rblist->node_delete(rblist, rb_node);
 }
 
@@ -87,8 +88,7 @@ void rblist__delete(struct rblist *rblist)
 		while (next) {
 			pos = next;
 			next = rb_next(pos);
-			rb_erase(pos, &rblist->entries);
-			rblist->node_delete(rblist, pos);
+			rblist__remove_node(rblist, pos);
 		}
 		free(rblist);
 	}

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

end of thread, other threads:[~2012-10-25  8:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31  7:09 [PATCH] [perf] Account the nr_entries in rblist properly Suzuki K. Poulose
2012-08-31 16:23 ` David Ahern
2012-10-17 17:38 ` David Ahern
2012-10-17 17:53   ` Arnaldo Carvalho de Melo
2012-10-25  8:00 ` [tip:perf/core] " tip-bot for Suzuki K. Poulose

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).