Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3221989imu; Sat, 24 Nov 2018 00:27:17 -0800 (PST) X-Google-Smtp-Source: AJdET5dm+M8my/CjBi6P47PgtzEWSFESieIHVAOtcSJgPIJQ/4AIYDluotRR5G6OmXqCF/7aepSo X-Received: by 2002:a65:6542:: with SMTP id a2mr16979570pgw.389.1543048037505; Sat, 24 Nov 2018 00:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048037; cv=none; d=google.com; s=arc-20160816; b=k9Rw2AXL3xAVI8Afut+guHOlgc2jN7bMBBsCuBPyi4Id9as1YhEszCM7J2GuI+N6x8 tpUpTuM6ZdwaIJmEsOTm5guYdNA9F+LXvD1Z6W9Ic3ESaggBMOpvmXrtw0k0O42EWH61 UyozXDCBfFZxhn2IjUBmHRlWt5pFIjnhxFKB9p/A03TVOjykIXH965VHmxM/hxxMhhtK i/gVOzoZAMLupOGb03H0rQoSoFrMskPnCJlBM6m25IIcFy971cJ2QCrOJqMel0er67e+ g8u9IsKq8uFMcx/xb8uW6Ev/LqgC/dlxYG0cX+zjrVXx/fv0n25cOC8gXcqXAOsnpK+z Ppgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=ykX+wzp37WtMKIYIaSTlo8HBVpuvQWSvOTnX0splKlw=; b=wTLEBZ+D10HTOnzGVk4Tb2LvWBWnrBwNu1Q6Y0Emw2830Mt9pIJx5dreCpFsVJ9kh9 cHbkOCh5LHQmXmTlEhrTbwSCh8Ue0j7/2JcPqv0uluMKZEolda7fN3Aocx86THjebywG oTPfxyDbvgmsml5Nc9gVYZZw3OnQ1AuOOtmgHlrxT49iZaPuFwJODOZesCnuAQ9u16Xp Fq76PKatz6u/30oKzG4FvOWbQ7et+A+5HSepCW9fY3D/qoar/0g2+iEH7bAPA6Qb9lRP P1liW7pgnedVlMcdgCwlciZoAltTmKEwVgoMNHhRWrDR3HZjNfnoiT89GlDVb4kUkpaj XrmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w66si54895566pgw.64.2018.11.24.00.27.03; Sat, 24 Nov 2018 00:27:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503633AbeKWV6E convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Nov 2018 16:58:04 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:36007 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409552AbeKWV6D (ORCPT ); Fri, 23 Nov 2018 16:58:03 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-58-ZDKerV0BO2CTEdE03nTIeQ-1; Fri, 23 Nov 2018 11:14:10 +0000 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 23 Nov 2018 11:14:17 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 23 Nov 2018 11:14:17 +0000 From: David Laight To: 'Kevin Easton' , Daniel Colascione CC: "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "timmurray@google.com" , "primiano@google.com" , "joelaf@google.com" , "Jonathan Corbet" , Andrew Morton , "Mike Rapoport" , Roman Gushchin , "Vlastimil Babka" , "Dennis Zhou (Facebook)" , Prashant Dhamdhere , "Eric W. Biederman" , "Steven Rostedt (VMware)" , Thomas Gleixner , Ingo Molnar , "Dominik Brodowski" , Pavel Tatashin , Josh Poimboeuf , "Ard Biesheuvel" , Michal Hocko , "MatthewWilcox@ip-172-31-15-78" Subject: RE: [PATCH] Add /proc/pid_generation Thread-Topic: [PATCH] Add /proc/pid_generation Thread-Index: AQHUglZTZJgLEEWYF0a4KhMuY5AKgaVdNbzw Date: Fri, 23 Nov 2018 11:14:17 +0000 Message-ID: References: <20181121201452.77173-1-dancol@google.com> <20181122111930.GA7164@ip-172-31-15-78> In-Reply-To: <20181122111930.GA7164@ip-172-31-15-78> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-MC-Unique: ZDKerV0BO2CTEdE03nTIeQ-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kevin Easton > Sent: 22 November 2018 11:20 > > On Wed, Nov 21, 2018 at 12:14:44PM -0800, Daniel Colascione wrote: > > 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. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)