linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: "Suzuki K. Poulose" <suzuki@in.ibm.com>,
	Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [perf] Account the nr_entries in rblist properly
Date: Fri, 31 Aug 2012 10:23:01 -0600	[thread overview]
Message-ID: <5040E4E5.6040905@gmail.com> (raw)
In-Reply-To: <20120831070834.14806.87398.stgit@suzukikp.in.ibm.com>

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>


  reply	other threads:[~2012-08-31 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-31  7:09 [PATCH] [perf] Account the nr_entries in rblist properly Suzuki K. Poulose
2012-08-31 16:23 ` David Ahern [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5040E4E5.6040905@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suzuki@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).