From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932088AbdJIXRj (ORCPT ); Mon, 9 Oct 2017 19:17:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59550 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755573AbdJIXRi (ORCPT ); Mon, 9 Oct 2017 19:17:38 -0400 Date: Mon, 9 Oct 2017 16:17:37 -0700 From: Andrew Morton To: Gargi Sharma 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 Message-Id: <20171009161737.ea8c62441cc12dfd909ee0b2@linux-foundation.org> In-Reply-To: <1507583624-22146-2-git-send-email-gs051095@gmail.com> References: <1507583624-22146-1-git-send-email-gs051095@gmail.com> <1507583624-22146-2-git-send-email-gs051095@gmail.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Oct 2017 17:13:43 -0400 Gargi Sharma 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?