mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Adrian Hunter <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@redhat.com, adrian.hunter@intel.com, mingo@kernel.org,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	acme@redhat.com, hpa@zytor.com
Subject: [tip:perf/core] perf thread-stack: Eliminate code duplicating thread_stack__pop_ks()
Date: Wed, 3 Jul 2019 07:02:42 -0700	[thread overview]
Message-ID: <tip-eb5d854456f5a4ccec6f9681b7196cf056df8cfa@git.kernel.org> (raw)
In-Reply-To: <20190619064429.14940-3-adrian.hunter@intel.com>

Commit-ID:  eb5d854456f5a4ccec6f9681b7196cf056df8cfa
Gitweb:     https://git.kernel.org/tip/eb5d854456f5a4ccec6f9681b7196cf056df8cfa
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Wed, 19 Jun 2019 09:44:29 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 25 Jun 2019 08:47:10 -0300

perf thread-stack: Eliminate code duplicating thread_stack__pop_ks()

Use new function thread_stack__pop_ks() in place of equivalent code.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190619064429.14940-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/thread-stack.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c
index 4c826a2e08d8..6ff1ff4d4ce7 100644
--- a/tools/perf/util/thread-stack.c
+++ b/tools/perf/util/thread-stack.c
@@ -664,12 +664,9 @@ static int thread_stack__no_call_return(struct thread *thread,
 
 	if (ip >= ks && addr < ks) {
 		/* Return to userspace, so pop all kernel addresses */
-		while (thread_stack__in_kernel(ts)) {
-			err = thread_stack__call_return(thread, ts, --ts->cnt,
-							tm, ref, true);
-			if (err)
-				return err;
-		}
+		err = thread_stack__pop_ks(thread, ts, sample, ref);
+		if (err)
+			return err;
 
 		/* If the stack is empty, push the userspace address */
 		if (!ts->cnt) {
@@ -679,12 +676,9 @@ static int thread_stack__no_call_return(struct thread *thread,
 		}
 	} else if (thread_stack__in_kernel(ts) && ip < ks) {
 		/* Return to userspace, so pop all kernel addresses */
-		while (thread_stack__in_kernel(ts)) {
-			err = thread_stack__call_return(thread, ts, --ts->cnt,
-							tm, ref, true);
-			if (err)
-				return err;
-		}
+		err = thread_stack__pop_ks(thread, ts, sample, ref);
+		if (err)
+			return err;
 	}
 
 	if (ts->cnt)

  reply	other threads:[~2019-07-03 14:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19  6:44 [PATCH 0/2] perf thread-stack: Fix thread stack return from kernel for kernel-only case Adrian Hunter
2019-06-19  6:44 ` [PATCH 1/2] " Adrian Hunter
2019-06-24 18:39   ` Arnaldo Carvalho de Melo
2019-07-03 14:01   ` [tip:perf/core] " tip-bot for Adrian Hunter
2019-06-19  6:44 ` [PATCH 2/2] perf thread-stack: Eliminate code duplicating thread_stack__pop_ks() Adrian Hunter
2019-07-03 14:02   ` tip-bot for Adrian Hunter [this message]
2019-06-24 18:44 ` [PATCH 0/2] perf thread-stack: Fix thread stack return from kernel for kernel-only case Arnaldo Carvalho de Melo

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=tip-eb5d854456f5a4ccec6f9681b7196cf056df8cfa@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome