Re: [PATCH] Add /proc/pid_generation
From: Pavel Machek <hidden>
Date: 2018-11-25 23:00:11
Also in:
lkml
Attachments
- signature.asc [application/pgp-signature] 181 bytes
From: Pavel Machek <hidden>
Date: 2018-11-25 23:00:11
Also in:
lkml
On Fri 2018-11-23 11:14:17, David Laight wrote:
From: Kevin Eastonquoted
Sent: 22 November 2018 11:20 On Wed, Nov 21, 2018 at 12:14:44PM -0800, Daniel Colascione wrote:quoted
This change adds a per-pid-namespace 64-bit generation number, incremented on PID rollover, and exposes it via a new proc file /proc/pid_generation. By examining this file before and after /proc enumeration, user code can detect the potential reuse of a PID and restart the task enumeration process, repeating until it gets a coherent snapshot.I see downthread this patch has been withdrawn, but nonetheless I'm still curious - does this actually solve the problem? It seems to me that a PID could be reused within a scan even if the generation number remains the same at the beginning and end of a scan:Why not allocate a 48bit generation number to each 16bit pid? Then you have a 64bit 'extended-pid' that can be assumed to never be reused. Provided enough interfaces are enhanced to support 'extended-pid' values you'll never get reused values.
For the record, I really like this proposal. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html