All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Gargi Sharma <gs051095@gmail.com>
Cc: linux-kernel@vger.kernel.org, riel@surriel.com,
	julia.lawall@lip6.fr, mingo@kernel.org,
	pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, oleg@redhat.com,
	ebiederm@xmission.com, hch@infradead.org
Subject: Re: [PATCH v4 1/2] pid: Replace pid bitmap implementation with IDR API
Date: Mon, 9 Oct 2017 16:17:37 -0700	[thread overview]
Message-ID: <20171009161737.ea8c62441cc12dfd909ee0b2@linux-foundation.org> (raw)
In-Reply-To: <1507583624-22146-2-git-send-email-gs051095@gmail.com>

On Mon,  9 Oct 2017 17:13:43 -0400 Gargi Sharma <gs051095@gmail.com> wrote:

> This patch replaces the current bitmap implemetation for
> Process ID allocation. Functions that are no longer required,
> for example, free_pidmap(), alloc_pidmap(), etc. are removed.
> The rest of the functions are modified to use the IDR API.
> The change was made to make the PID allocation less complex by
> replacing custom code with calls to generic API.
> 

I can't say I really understand the locking here.

>
> ...
>
> @@ -240,17 +230,11 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
>  	 *
>  	 */
>  	read_lock(&tasklist_lock);
> -	nr = next_pidmap(pid_ns, 1);
> -	while (nr > 0) {
> -		rcu_read_lock();
> -
> -		task = pid_task(find_vpid(nr), PIDTYPE_PID);
> +	nr = 2;
> +	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);
> -
> -		rcu_read_unlock();
> -
> -		nr = next_pidmap(pid_ns, nr);
>  	}
>  	read_unlock(&tasklist_lock);

Especially here.  I don't think pidmap_lock is held.  Is that IDR
iteration safe?

  reply	other threads:[~2017-10-09 23:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 21:13 [PATCH v4 0/2] Replacing PID bitmap implementation with IDR API Gargi Sharma
2017-10-09 21:13 ` [PATCH v4 1/2] pid: Replace pid " Gargi Sharma
2017-10-09 23:17   ` Andrew Morton [this message]
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
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 14:15       ` Rik van Riel
2017-10-11 21:22       ` Luck, Tony
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=20171009161737.ea8c62441cc12dfd909ee0b2@linux-foundation.org \
    --to=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 \
    --cc=riel@surriel.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 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.