From: Rik van Riel <riel@surriel.com>
To: Gargi Sharma <gs051095@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Julia Lawall <julia.lawall@lip6.fr>,
mingo@kernel.org, pasha.tatashin@oracle.com,
ktkhai@virtuozzo.com, "Eric W. Biederman" <ebiederm@xmission.com>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v4 1/2] pid: Replace pid bitmap implementation with IDR API
Date: Tue, 10 Oct 2017 13:51:06 -0400 [thread overview]
Message-ID: <1507657866.10046.44.camel@surriel.com> (raw)
In-Reply-To: <CAOCi2DFoAEgnoBWmqwhpnd8+Y4ixTueKkpdMKom2YpDbnopFGw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]
On Tue, 2017-10-10 at 17:11 +0100, Gargi Sharma wrote:
>
> I have listed down the code for both idr_for_each and
> idr_for_each_entry.
> IMHO idr_for_each_entry is easier to read, but YMMV. :)
>
> void kill_task(int id, void *ptr, void *data)
> {
> struct *pid = ptr;
> struct task_struct *task = pid_task(pid, PIDTYPE_PID);
> if (task && !__fatal_signal_pending(task))
> send_sig_info(SIGKILL, SEND_SIG_FORCED, task);
> }
>
> rcu_read_unlock();
> idr_for_each(&pid_ns->idr, &kill_task, NULL);
> rcu_read_unlock();
It also looks like idr_for_each has no easy
way to skip over PID 1, like you can do with
idr_for_each_entry_continue().
I agree with you, the code below is easier to
read than the code above.
> idr_for_each_entry_continue(&pid_ns->idr, pid, nr) {
> task = pid_task(pid, PIDTYPE_PID);
> if (task && !__fatal_signal_pending(task))
> send_sig_info(SIGKILL, SEND_SIG_FORCED, task);
> }
>
> Thanks!
> Gargi
> >
> > --
> > All rights reversed
>
>
--
All rights reversed
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2017-10-10 17:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 21:13 [PATCH v4 0/2] Replacing PID " Gargi Sharma
2017-10-09 21:13 ` [PATCH v4 1/2] pid: Replace pid " Gargi Sharma
2017-10-09 23:17 ` Andrew Morton
2017-10-10 11:50 ` Oleg Nesterov
2017-10-10 12:35 ` Gargi Sharma
2017-10-10 14:15 ` Oleg Nesterov
2017-10-10 15:46 ` Rik van Riel
2017-10-10 16:11 ` Gargi Sharma
2017-10-10 17:51 ` Rik van Riel [this message]
2017-10-10 13:44 ` Rik van Riel
2017-10-09 21:13 ` [PATCH v4 2/2] pid: Remove pidhash Gargi Sharma
2017-10-11 9:47 ` kbuild test robot
2017-10-11 14:15 ` Rik van Riel
2017-10-11 21:22 ` Luck, Tony
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=1507657866.10046.44.camel@surriel.com \
--to=riel@surriel.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=gs051095@gmail.com \
--cc=hch@infradead.org \
--cc=julia.lawall@lip6.fr \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=pasha.tatashin@oracle.com \
/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
Powered by JetHome