From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751132AbdJBNOs (ORCPT ); Mon, 2 Oct 2017 09:14:48 -0400 Received: from shelob.surriel.com ([96.67.55.147]:50912 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbdJBNOr (ORCPT ); Mon, 2 Oct 2017 09:14:47 -0400 Message-ID: <1506950074.21121.117.camel@surriel.com> Subject: Re: [PATCH v2 1/2] pid: Replace pid bitmap implementation with IDR API From: Rik van Riel To: Gargi Sharma , Christoph Hellwig Cc: linux-kernel@vger.kernel.org, Julia Lawall , akpm@linux-foundation.org, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, Oleg Nesterov Date: Mon, 02 Oct 2017 09:14:34 -0400 In-Reply-To: References: <20171001091520.GA21161@infradead.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-CAkKz80whfNeltapjTQw" 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 --=-CAkKz80whfNeltapjTQw Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2017-10-01 at 16:05 +0530, Gargi Sharma wrote: > On Sun, Oct 1, 2017 at 2:45 PM, Christoph Hellwig > wrote: > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0task_active_pid_ns(current)->last_pid); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0task_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 > idr_get_cursor() get can be used instead of idr.idr_next, so that we > do not > expose 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? >=20 > -1 will be incorrect when the pids wrap around. Should we go back to > setting up last_pid as it was done before? Or should we use > idr_get_cursor > and determine if pid was rolled over and then perform necessary > action? Looking at it some more, it appears the value is only ever used in /proc/loadavg. Would anyone object to the code simply calling idr_get_cursor() as is, and leaving out the -1? Somehow I suspect nobody will care that the pid value in /proc/loadavg reflects the next PID allocated, rather than the previous one. Any objections? --=20 All Rights Reversed. --=-CAkKz80whfNeltapjTQw 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 iQEcBAABCAAGBQJZ0ju6AAoJEM553pKExN6DTkEH/iM5Kajl7iwXr/t7QIh7tVzS Wq6y3rAvnd8kDWhAGYfDglVk7i+9sDPYtBjvvu2yiVyOkH+MVNmu5jIwur7hSl8W 3uKLynhTf5+siumtB7VM7Jr4YJDGvDjoVMpoffVazXifkuWTG5dGkRgqzqxAtpDK ypOWpF0efDshLhabfWZkzfAsrB5CJtpWy+bwgqoOLI6pzU3S59aMY1nFKxcS1lqn byXDDUj2220lKKCV8ccCa0XmTDdTQamMgNcAAuAkbU90DAPcAxAc4lA3E+vWIhm2 c4p6dDSoqVOQ1D+4lQ9J16PVRZx56HJD1TNcZnMHVnOCqjyf3o0xqIOeOGPf4bE= =xoH8 -----END PGP SIGNATURE----- --=-CAkKz80whfNeltapjTQw--