From: Michael Ellerman <mpe@ellerman.id.au>
To: Denis Kirjanov <kda@linux-powerpc.org>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/xmon: fix task state output
Date: Wed, 27 Oct 2021 12:11:15 +1100 [thread overview]
Message-ID: <87bl3bb7bg.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20211026133108.7113-1-kda@linux-powerpc.org>
Denis Kirjanov <kda@linux-powerpc.org> writes:
> p_state is unsigned since the commit 2f064a59a11f
>
> The patch also uses TASK_RUNNING instead of null.
>
> Fixes: 2f064a59a11f ("sched: Change task_struct::state")
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
> arch/powerpc/xmon/xmon.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index dd8241c009e5..8b28ff9d98d1 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -3264,8 +3264,7 @@ static void show_task(struct task_struct *volatile tsk)
> * appropriate for calling from xmon. This could be moved
> * to a common, generic, routine used by both.
> */
> - state = (p_state == 0) ? 'R' :
> - (p_state < 0) ? 'U' :
I guess 'U' meant 'unknown'? I always thought it meant uninterruptible,
but obviously that is 'D'.
> + state = (p_state == TASK_RUNNING) ? 'R' :
> (p_state & TASK_UNINTERRUPTIBLE) ? 'D' :
> (p_state & TASK_STOPPED) ? 'T' :
> (p_state & TASK_TRACED) ? 'C' :
I think a better cleanup would be to use task_is_running(),
task_is_traced(), task_is_stopped(). That way we're insulated somewhat
from any future changes.
That would add additional READ_ONCE()s of the state, but I don't think
we care, the task should not be running if the system is in xmon.
cheers
next prev parent reply other threads:[~2021-10-27 1:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 13:31 [PATCH] powerpc/xmon: fix task state output Denis Kirjanov
2021-10-27 1:11 ` Michael Ellerman [this message]
2021-10-27 12:36 ` Denis Kirjanov
2021-11-02 10:12 ` Michael Ellerman
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=87bl3bb7bg.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=kda@linux-powerpc.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.