Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739256

Re: [PATCH 1/8] sched: Consistent task-state printing

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/8] sched: Consistent task-state printing
Date 2017-09-25 22:10 +0200
Message-ID <utHRw-2MV-9@gated-at.bofh.it> (permalink)
References <utAwF-6f6-7@gated-at.bofh.it> <utAwG-6f6-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 25 Sep 2017 14:07:48 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> +static inline char __task_state_to_char(unsigned int state)
> +{
> +	static const char state_char[] = "RSDTtXZ";
> +
> +	BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != sizeof(state_char) - 2);
>  
> -	return state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?';
> +	return state_char[state];
> +}
> +
> +static inline char task_state_to_char(struct task_struct *tsk)
> +{
> +	return __task_state_to_char(__get_task_state(tsk));
>  }
>  

So far I'm fine with the patch set, but I hate the non descriptive "__"
prefix of __task_state_to_char(). Can we make this a bit more
descriptive, because every time I see it in other patches, I go back to
this patch to see if we are using the right function.

What about something like:

task_state_to_state_char(unsigned int state);

task_to_state_char(struct task_struct *tsk);

?

This way, the "__" wont keep making me think we used the wrong
function.

-- Steve

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/8] sched: Consistent task-state printing Peter Zijlstra <peterz@infradead.org> - 2017-09-25 14:20 +0200
  Re: [PATCH 1/8] sched: Consistent task-state printing Steven Rostedt <rostedt@goodmis.org> - 2017-09-25 22:10 +0200

csiph-web