UML - get_wchan fixes
PATCH 6/6 UML - get_wchan fixes
[ 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.
--- arch/um/kernel/process.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
arch/um/kernel/process.c +7 -9
@@ -462,7 +462,8 @@ unsigned long arch_align_stack(unsignedunsigned 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_struwhile (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 ); }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel