From: Mike Rapoport <rppt@linux.vnet.ibm.com>
To: Balbir Singh <bsingharora@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Darren Hart <dvhart@infradead.org>,
Oleg Nesterov <oleg@redhat.com>, linux-mm <linux-mm@kvack.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] pids: introduce find_get_task_by_vpid helper
Date: Mon, 30 Oct 2017 11:44:37 +0200 [thread overview]
Message-ID: <20171030094436.GA3141@rapoport-lnx> (raw)
In-Reply-To: <CAKTCnzn1-MMK+o-u2F3gcvCaq7Upk-5M2qOS9XaGV6-gcJRqBw@mail.gmail.com>
On Mon, Oct 30, 2017 at 07:51:42PM +1100, Balbir Singh wrote:
> On Sat, Oct 28, 2017 at 4:52 AM, Mike Rapoport <rppt@linux.vnet.ibm.com> wrote:
> > There are several functions that do find_task_by_vpid() followed by
> > get_task_struct(). We can use a helper function instead.
> >
> > Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
> > ---
>
> I did a quick grep and found other similar patterns in
(reordered the file list a bit)
> kernel/events/core.c,
> arch/x86/kernel/cpu/intel_rdt_rdtgroup.c,
> mm/mempolicy.c,
Those and mm/migrate.c indeed have a similar pattern, but they all do
task = pid ? find_task_by_vpid(pid) : current;
And I don't see an elegant way to use find_get_task_by_vpid() in this case.
> kernel/kcmp.c,
kcmp gets both tasks between rcu_read_lock/unlock and I think it's better
to keep it this way.
> kernel/sys.c,
There is no get_task_struct() after find_task_by_vpid(), unless I've missed
something
> kernel/time/posix-cpu-timers.c,
Here the task is selected with more complex logic than just
find_task_by_vpid()
> mm/process_vm_access.c,
Converted in the patch
> security/yama/yama_lsm.c,
> arch/ia64/kernel/perfmon.c
I've missed these two, indeed.
The arch/ia64/kernel/perfmon.c even still uses read_lock(&tasklist) rather
than rcu_read_lock()...
> Balbir Singh.
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2017-10-30 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 17:52 [PATCH v2] pids: introduce find_get_task_by_vpid helper Mike Rapoport
2017-10-30 8:51 ` Balbir Singh
2017-10-30 9:44 ` Mike Rapoport [this message]
2017-10-31 16:39 ` Oleg Nesterov
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=20171030094436.GA3141@rapoport-lnx \
--to=rppt@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=bsingharora@gmail.com \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).