diff options
Diffstat (limited to 'fs/proc/array.c')
| -rw-r--r-- | fs/proc/array.c | 24 | 
1 files changed, 8 insertions, 16 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index cbd0f1b324b..64db2bceac5 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -138,26 +138,17 @@ static const char * const task_state_array[] = {  	"D (disk sleep)",	/*   2 */  	"T (stopped)",		/*   4 */  	"t (tracing stop)",	/*   8 */ -	"Z (zombie)",		/*  16 */ -	"X (dead)",		/*  32 */ -	"x (dead)",		/*  64 */ -	"K (wakekill)",		/* 128 */ -	"W (waking)",		/* 256 */ -	"P (parked)",		/* 512 */ +	"X (dead)",		/*  16 */ +	"Z (zombie)",		/*  32 */  };  static inline const char *get_task_state(struct task_struct *tsk)  { -	unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; -	const char * const *p = &task_state_array[0]; +	unsigned int state = (tsk->state | tsk->exit_state) & TASK_REPORT; -	BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array)); +	BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array)-1); -	while (state) { -		p++; -		state >>= 1; -	} -	return *p; +	return task_state_array[fls(state)];  }  static inline void task_state(struct seq_file *m, struct pid_namespace *ns, @@ -183,6 +174,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,  	seq_printf(m,  		"State:\t%s\n"  		"Tgid:\t%d\n" +		"Ngid:\t%d\n"  		"Pid:\t%d\n"  		"PPid:\t%d\n"  		"TracerPid:\t%d\n" @@ -190,6 +182,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,  		"Gid:\t%d\t%d\t%d\t%d\n",  		get_task_state(p),  		task_tgid_nr_ns(p, ns), +		task_numa_group_id(p),  		pid_nr_ns(pid, ns),  		ppid, tpid,  		from_kuid_munged(user_ns, cred->uid), @@ -451,8 +444,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,  				min_flt += t->min_flt;  				maj_flt += t->maj_flt;  				gtime += task_gtime(t); -				t = next_thread(t); -			} while (t != task); +			} while_each_thread(task, t);  			min_flt += sig->min_flt;  			maj_flt += sig->maj_flt;  | 
