Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp817892pxb; Thu, 24 Mar 2022 07:32:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYQRG/q6li5jT4KeFY0hAa2Hj0KUhXkz/08UuUKvW/fUSqT+equTCZPhJZ5gZPs+8lsgjk X-Received: by 2002:aa7:dc0b:0:b0:413:ce06:898e with SMTP id b11-20020aa7dc0b000000b00413ce06898emr7202088edu.244.1648132354983; Thu, 24 Mar 2022 07:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648132354; cv=none; d=google.com; s=arc-20160816; b=QRtN0Od/juOxggD4kWy+6vbXv6LUcmsvRZQl+kFjhBSTavopOusu6Hp/hm6igjB3Wc F6pPV7gh84Dvdl+ncd/j1a73Q7mjhhVaS4nOmglekC2O6CJd0U01XpNJ5UE5tFEpi9wc sGrOcV0sQdDk3oPbCG+syeZtRL4Nzk0UCn6EI+hRDFyIT5T2XzdeNxGMKgHxKDOGlnKR 9qsT+rLAGrVGZUeFrrbJzGcX6J5kdyv2pvdlC/qDaIsEQu1IFYvKKQzSURoPgtPRgUHg Ki1iFfYnMvAPKTYcS3wQIBrgalqU5ZUmrwdAoMM4KfFhc+PaYzYYiDTt53WWexwK2gBF XZ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=++pYMAFi8siFITGTtI8OJ/ZLZmlTf/qSvmoDsoiudic=; b=wUPejQ14x4X2bmeT0mulWVnTotRhY/DfFwp/rZiGd2LiszNFKhlTKeOEF9gDaythsm c0xE6pdY3U8bZV9x85tEoGfwJJS7CbJ+uFs75RUrv/2hNzkQMyAb9m8Ou7WXg3PBbkJT Xb5KNgMYxPpRs5nDuH+SXYgObUI3zx8ihupxTzUjYnrlTFfIZBMFxw9Rr79dzHh+xuUZ 2tyEQTCktkY8Sszt0cuqMTLe/u0KxxKJ9kKJTrSxn5qtsZ+nFdzFyTQJn2F2oQtSOuko ErM/eEC66/rZbrJd8f4csCkjMvavgtHqZ8c9Vmk22Dpw2g1dxKflzBdFbZqT7ht6zTHl hJ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bLvvkukA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a170906208700b006df838687e7si15359643ejq.20.2022.03.24.07.32.09; Thu, 24 Mar 2022 07:32:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bLvvkukA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348986AbiCXIq0 (ORCPT + 99 others); Thu, 24 Mar 2022 04:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244644AbiCXIqZ (ORCPT ); Thu, 24 Mar 2022 04:46:25 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4576E9BBB5 for ; Thu, 24 Mar 2022 01:44:51 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id p15so7666933ejc.7 for ; Thu, 24 Mar 2022 01:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=++pYMAFi8siFITGTtI8OJ/ZLZmlTf/qSvmoDsoiudic=; b=bLvvkukA8BB7oL86pGuChsm+aSNaBbNixr+1oNjsVP/ANz9qs22bL+0co9+LxeTzLr p3/WfqNXLKRw5+YHpINrfHfutnGeCd8YeacpkAp7M5/e+ZXmlEcFJraf7HOoRtUvvuzU pRsj5BGCkDl5Z0LzlawnSEndD3gSIn0EoXRDs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=++pYMAFi8siFITGTtI8OJ/ZLZmlTf/qSvmoDsoiudic=; b=cnrMvXaL+06rfBAbf4yeGj6RTLcrbbNpR5vlc0J+Hrn88e+0ShZjdzj2dOdbBfSpZy LJVoKvGeYgML4eiHoZe8GPX0j4MnAu1EceHZBMlDxWZireC98dZPhxh4kiz96C4ihtsn CqBxXUTv8PEclDYofPsSogoAGCQK2gxAViHO2BCG0IlBJf39Hu6/Xx/bs59iGBxGx+an p0IuALqYcJlkZk95+dwPn8AhXbf4x9exObhAUS5csy9xlap4yyjeIoUvOKqMXrzPj85j JXeuACQYH1ClCkiRnmMaOhrmJHHFfcjRsYm1bbt4pzPR9lQYUnmerUzLl8acz8QslrAn 2fTg== X-Gm-Message-State: AOAM5327mHk52aDf6IPjDcBQCgMMZxTMiwL8LuU1I2Rgb1zICfjQTmQ/ zJaBntiChADql31KmVY/eFpIZOUk4GgzV0QDnUggbA== X-Received: by 2002:a17:906:2991:b0:6cf:6b24:e92f with SMTP id x17-20020a170906299100b006cf6b24e92fmr4461589eje.748.1648111489773; Thu, 24 Mar 2022 01:44:49 -0700 (PDT) MIME-Version: 1.0 References: <20220322192712.709170-1-mszeredi@redhat.com> <20220323114215.pfrxy2b6vsvqig6a@wittgenstein> In-Reply-To: From: Miklos Szeredi Date: Thu, 24 Mar 2022 09:44:38 +0100 Message-ID: Subject: Re: [RFC PATCH] getvalues(2) prototype To: "Theodore Ts'o" Cc: Christian Brauner , Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linux API , linux-man , LSM , Karel Zak , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , James Bottomley Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Mar 2022 at 23:20, Theodore Ts'o wrote: > > On Wed, Mar 23, 2022 at 02:24:40PM +0100, Miklos Szeredi wrote: > > The reason I stated thinking about this is that Amir wanted a per-sb > > iostat interface and dumped it into /proc/PID/mountstats. And that is > > definitely not the right way to go about this. > > > > So we could add a statfsx() and start filling in new stuff, and that's > > what Linus suggested. But then we might need to add stuff that is not > > representable in a flat structure (like for example the stuff that > > nfs_show_stats does) and that again needs new infrastructure. > > > > Another example is task info in /proc. Utilities are doing a crazy > > number of syscalls to get trivial information. Why don't we have a > > procx(2) syscall? I guess because lots of that is difficult to > > represent in a flat structure. Just take the lsof example: tt's doing > > hundreds of thousands of syscalls on a desktop computer with just a > > few hundred processes. > > I'm still a bit puzzled about the reason for getvalues(2) beyond, > "reduce the number of system calls". Is this a performance argument? One argument that can't be worked around without batchingis atomicity. Not sure how important that is, but IIRC it was one of the requirements relating to the proposed fsinfo syscall, which this API is meant to supersede. Performance was also oft repeated regarding the fsinfo API, but I'm less bought into that. > If so, have you benchmarked lsof using this new interface? Not yet. Looked yesterday at both lsof and procps source code, and both are pretty complex and not easy to plug in a new interface. But I've not yet given up... > I did a quickie run on my laptop, which currently had 444 process. > "lsof /home/tytso > /tmp/foo" didn't take long: > > % time lsof /home/tytso >& /tmp/foo > real 0m0.144s > user 0m0.039s > sys 0m0.087s > > And an strace of that same lsof command indicated had 67,889 lines. > So yeah, lots of system calls. But is this new system call really > going to speed up things by all that much? $ ps uax | wc -l 335 $ time lsof > /dev/null real 0m3.011s user 0m1.257s sys 0m1.249s $ strace -o /tmp/strace lsof > /dev/null $ wc -l /tmp/strace 638523 /tmp/strace That's an order of magnitude higher than in your case; don't know what could cause this. Thanks, Millos