Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932950AbdIXVbr (ORCPT ); Sun, 24 Sep 2017 17:31:47 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:49552 "EHLO mail-it0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932155AbdIXVbp (ORCPT ); Sun, 24 Sep 2017 17:31:45 -0400 X-Google-Smtp-Source: AOwi7QAFGHcHU3ixwsgQDkWFRazLeoeQ3KGvM1gbAGFw9VG5WgtExhZ/UH1l/7Jqrn5jwKNx5l4vI0dff95DeHm540M= MIME-Version: 1.0 In-Reply-To: <20170924200620.GA24368@avx2> References: <20170924200620.GA24368@avx2> From: Andy Lutomirski Date: Sun, 24 Sep 2017 14:31:23 -0700 Message-ID: Subject: Re: [PATCH 1/2 v2] fdmap(2) To: Alexey Dobriyan Cc: Andrew Morton , "linux-kernel@vger.kernel.org" , Linux API , Randy Dunlap , Thomas Gleixner , Djalal Harouni , Alexey Gladkov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8OLVq19029085 Content-Length: 1079 Lines: 26 On Sun, Sep 24, 2017 at 1:06 PM, Alexey Dobriyan wrote: > From: Aliaksandr Patseyenak > > Implement system call for bulk retrieveing of opened descriptors > in binary form. > > Some daemons could use it to reliably close file descriptors > before starting. Currently they close everything upto some number > which formally is not reliable. Other natural users are lsof(1) and CRIU > (although lsof does so much in /proc that the effect is thoroughly buried). > > /proc, the only way to learn anything about file descriptors may not be > available. There is unavoidable overhead associated with instantiating > 3 dentries and 3 inodes and converting integers to strings and back. > > Benchmark: > > N=1<<22 times > 4 opened descriptors (0, 1, 2, 3) > opendir+readdir+closedir /proc/self/fd vs fdmap > > /proc 8.31 ą 0.37% > fdmap 0.32 ą 0.72% This doesn't have the semantic problem that pidmap does, but I still wonder why this can't be accomplished by adding a new file in /proc.