From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Chunguang Wu <aman2008@qq.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs/proc: add Kthread flag to /proc/$pid/status
Date: Thu, 13 Apr 2023 21:36:58 +0300 [thread overview]
Message-ID: <59774223-680e-4b64-87ea-ab7e524be369@p183> (raw)
In-Reply-To: <20230412141216.c8f2c1313f34ee0100ac9ae4@linux-foundation.org>
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@qq.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?
next prev parent reply other threads:[~2023-04-13 18:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_3E1CBD85D91AD4CDDCB5F429A3948EB94306@qq.com>
2023-04-12 21:12 ` Andrew Morton
2023-04-13 18:36 ` Alexey Dobriyan [this message]
2023-04-14 9:27 Chunguang Wu
2023-04-14 15:17 ` Randy Dunlap
2023-04-15 8:21 Chunguang Wu
2023-04-15 16:03 ` Randy Dunlap
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=59774223-680e-4b64-87ea-ab7e524be369@p183 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aman2008@qq.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®