From: Jeff Dike <jdike@addtoit.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Joe Perches <joe@perches.com>,
LKML <linux-kernel@vger.kernel.org>,
uml-devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [PATCH 6/6] UML - get_wchan fixes
Date: Fri, 2 Nov 2007 11:40:15 -0400 [thread overview]
Message-ID: <20071102154015.GA10288@c2.user-mode-linux.org> (raw)
[ This can be merged with uml-implement-get_wchan.patch ]
The previous get_wchan patch needed some more work. Joe Perches
suggested the use of bool where I was using a counter. It also turned
out not to work so well on x86_64, so I changed the algorithm a bit.
Instead of skipping one frame and looking for the next non-sched
symbol, it now looks for at least one scheduler frame, then returns
the first symbol seen above that.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
---
arch/um/kernel/process.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
Index: linux-2.6.22/arch/um/kernel/process.c
===================================================================
--- linux-2.6.22.orig/arch/um/kernel/process.c 2007-10-31 13:16:40.000000000 -0400
+++ linux-2.6.22/arch/um/kernel/process.c 2007-10-31 13:17:00.000000000 -0400
@@ -462,7 +462,8 @@ unsigned long arch_align_stack(unsigned
unsigned long get_wchan(struct task_struct *p)
{
- unsigned long stack_page, sp, ip, count = 0;
+ unsigned long stack_page, sp, ip;
+ bool seen_sched = 0;
if ((p == NULL) || (p == current) || (p->state == TASK_RUNNING))
return 0;
@@ -482,14 +483,11 @@ unsigned long get_wchan(struct task_stru
while (sp < stack_page + THREAD_SIZE) {
ip = *((unsigned long *) sp);
- if (kernel_text_address(ip) && !in_sched_functions(ip)) {
- /*
- * Skip one valid IP, which will be the low-level UML
- * context switcher.
- */
- if (count++ == 1)
- return ip;
- }
+ if (in_sched_functions(ip))
+ /* Ignore everything until we're above the scheduler */
+ seen_sched = 1;
+ else if (kernel_text_address(ip) && seen_sched)
+ return ip;
sp += sizeof(unsigned long);
}
reply other threads:[~2007-11-02 15:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20071102154015.GA10288@c2.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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