File tree Expand file tree Collapse file tree 3 files changed +23
-18
lines changed Expand file tree Collapse file tree 3 files changed +23
-18
lines changed Original file line number Diff line number Diff line change @@ -95,23 +95,11 @@ static inline int object_is_on_stack(const void *obj)
95
95
extern void thread_stack_cache_init (void );
96
96
97
97
#ifdef CONFIG_DEBUG_STACK_USAGE
98
+ unsigned long stack_not_used (struct task_struct * p );
99
+ #else
98
100
static inline unsigned long stack_not_used (struct task_struct * p )
99
101
{
100
- unsigned long * n = end_of_stack (p );
101
-
102
- do { /* Skip over canary */
103
- # ifdef CONFIG_STACK_GROWSUP
104
- n -- ;
105
- # else
106
- n ++ ;
107
- # endif
108
- } while (!* n );
109
-
110
- # ifdef CONFIG_STACK_GROWSUP
111
- return (unsigned long )end_of_stack (p ) - (unsigned long )n ;
112
- # else
113
- return (unsigned long )n - (unsigned long )end_of_stack (p );
114
- # endif
102
+ return 0 ;
115
103
}
116
104
#endif
117
105
extern void set_task_stack_end_magic (struct task_struct * tsk );
Original file line number Diff line number Diff line change @@ -778,6 +778,25 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
778
778
}
779
779
780
780
#ifdef CONFIG_DEBUG_STACK_USAGE
781
+ unsigned long stack_not_used (struct task_struct * p )
782
+ {
783
+ unsigned long * n = end_of_stack (p );
784
+
785
+ do { /* Skip over canary */
786
+ # ifdef CONFIG_STACK_GROWSUP
787
+ n -- ;
788
+ # else
789
+ n ++ ;
790
+ # endif
791
+ } while (!* n );
792
+
793
+ # ifdef CONFIG_STACK_GROWSUP
794
+ return (unsigned long )end_of_stack (p ) - (unsigned long )n ;
795
+ # else
796
+ return (unsigned long )n - (unsigned long )end_of_stack (p );
797
+ # endif
798
+ }
799
+
781
800
/* Count the maximum pages reached in kernel stacks */
782
801
static inline void kstack_histogram (unsigned long used_stack )
783
802
{
Original file line number Diff line number Diff line change @@ -7405,7 +7405,7 @@ EXPORT_SYMBOL(io_schedule);
7405
7405
7406
7406
void sched_show_task (struct task_struct * p )
7407
7407
{
7408
- unsigned long free = 0 ;
7408
+ unsigned long free ;
7409
7409
int ppid ;
7410
7410
7411
7411
if (!try_get_task_stack (p ))
@@ -7415,9 +7415,7 @@ void sched_show_task(struct task_struct *p)
7415
7415
7416
7416
if (task_is_running (p ))
7417
7417
pr_cont (" running task " );
7418
- #ifdef CONFIG_DEBUG_STACK_USAGE
7419
7418
free = stack_not_used (p );
7420
- #endif
7421
7419
ppid = 0 ;
7422
7420
rcu_read_lock ();
7423
7421
if (pid_alive (p ))
You can’t perform that action at this time.
0 commit comments