From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751241AbdJBNFu (ORCPT ); Mon, 2 Oct 2017 09:05:50 -0400 Received: from shelob.surriel.com ([96.67.55.147]:50775 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbdJBNFt (ORCPT ); Mon, 2 Oct 2017 09:05:49 -0400 Message-ID: <1506949534.21121.115.camel@surriel.com> Subject: Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API From: Rik van Riel To: Christoph Hellwig , Gargi Sharma Cc: linux-kernel@vger.kernel.org, julia.lawall@lip6.fr, akpm@linux-foundation.org, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, oleg@redhat.com Date: Mon, 02 Oct 2017 09:05:34 -0400 In-Reply-To: <20171001091520.GA21161@infradead.org> References: <20171001091520.GA21161@infradead.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-YHHMdEUvA36Z5GfhIPVw" X-Mailer: Evolution 3.22.6 (3.22.6-2.fc25) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-YHHMdEUvA36Z5GfhIPVw Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2017-10-01 at 02:15 -0700, Christoph Hellwig wrote: > > - task_active_pid_ns(current)->last_pid); > > + task_active_pid_ns(current)->idr.idr_next-1); >=20 > I think we want a well documented helper for this pattern instead > of poking into the internals. >=20 > Also is last - 1 always the correct answer?=C2=A0=C2=A0Even with > idr_alloc_cyclic > we could wrap around, couldn't we? Good point. I wonder if it makes sense to change the IDR code, so idr_get_cursor returns the last allocated ID? I see only two users of idr_get_cursor in the kernel, and it looks like both would work fine if idr_get_cursor returned the previously allocated value. That would require a small change to idr_alloc_cyclic, to have it start searching at a position one larger than the cursor, and maybe renaming idr->idr_next to idr->cursor, since it would now represent the last value allocated, not the next. Would that make sense? --=20 All Rights Reversed. --=-YHHMdEUvA36Z5GfhIPVw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJZ0jmeAAoJEM553pKExN6DKUYH+gPLvG7MeRkqpzxQTAgY2yWh S170OfZ2T+s58AZdObxyilM41RwSyG+EBm0eYsMBmewKjzoko4bLxiQKe4bInilk 1FKiwAv4YG/toA50ELsngwD3/4qF2+rwFwydU/4S/D6shQbZ7jdn1tlRQQtOeYpS kqll0JyGOop3NPVRXqtklydbTcZCP/OkpNHMmUNVqgtnp76y4RGihFUyUOo8oID1 sHS8subuelblSNLG+B5W/0m/lniwBUXAcs1PnE2YnkucJc1RnoZfAGS79GPFbKej yUVJaNq8t4MV4UKO+j1WI/a9/l5hdBCXwWX69AgHzsSYQs61tERmwLVxqDgm5zo= =ZH8S -----END PGP SIGNATURE----- --=-YHHMdEUvA36Z5GfhIPVw--