[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <59774223-680e-4b64-87ea-ab7e524be369@p183>
Date: Thu, 13 Apr 2023 21:36:58 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Chunguang Wu <aman2008@...com>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] fs/proc: add Kthread flag to /proc/$pid/status
On Wed, Apr 12, 2023 at 02:12:16PM -0700, Andrew Morton wrote:
> On Wed, 12 Apr 2023 22:34:02 +0800 Chunguang Wu <aman2008@...com> wrote:
>
> > user can know that a process is kernel thread or not.
> >
> > ...
> >
> > --- a/fs/proc/array.c
> > +++ b/fs/proc/array.c
> > @@ -434,6 +434,12 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
> >
> > task_state(m, ns, pid, task);
> >
> > + if ((mm == NULL) || (task->flags & PF_KTHREAD)) {
> > + seq_puts(m, "Kthread:\tYes\n");
> > + } else {
> > + seq_puts(m, "Kthread:\tNo\n");
> > + }
"mm" check is redundant. PF_KTHREAD should be enough.
If you're doing this, just print 0/1.
> > if (mm) {
> > task_mem(m, mm);
> > task_core_dumping(m, task);
>
> Well.. Why is this information useful?
I want to add: for a shell script.
Real programs can read /proc/*/stat .
> What is the use case?
>
> There are many ways of working this out from the existing output - why
> is this change required?
Powered by blists - more mailing lists