Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36917327rwd; Tue, 11 Jul 2023 07:17:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlH0EwRBijtGDxTHR0xEM/++vj0EbknRzGuhzvrX9IN2o0lDOwdHxWQYUh/dCl175XX1jDun X-Received: by 2002:a05:6402:12c1:b0:51e:4e7:b2fc with SMTP id k1-20020a05640212c100b0051e04e7b2fcmr10178767edx.28.1689085047348; Tue, 11 Jul 2023 07:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689085047; cv=none; d=google.com; s=arc-20160816; b=Qa7EGCpm8omnQyQPDiUuUgW6JPTD541FRVTEHpmt70k7PFpsxp3JeHx4HImDPE4ezH mVREV0Yj8j4OcRDzKZwGyyNiUHN/eCuJpHeY2MWYqbk4RTzC8XGdI31sF4JPQUV815Nf VeryiVPW8glitoa3c1Kk22S+zisDHNt1aquEriUzQxAbjL1cpUSsj5FUrNOiXcuAfPZp cnzc8ea0QUeEqUODNDDi+vuPZbVFxJvdQddGoky1rLLFh55nJ06dLvYnTxo7jMUNVivW TaRzW0WuG/tmyEMXI9YBM3xgNjANrwkiok9/RoeCdb9TAGjq+0brLHetQM2jB7MvWcar 7seg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=20bA/npftyxxUSAFbBrVwX//8aYUt2AliWpHhdzg0BE=; fh=T7pqVOsE7dWyrgnHrguUsJWNhctf0XC4/gRfWUlst0s=; b=BWKv5BOoLhJDVC+Cc9DiBkImEgr8VHOPq/AUMDlGoZtFgJl+EelQKIReluUr5FBADP IB36l+lXX1rDGwzwJBaQ9v84etQnV/OLcsUGtDedUSAlPBC06QBTd1LgG2pIzVhmQiJQ YcdhI1aImKYyJjdHezv2X4Hfw4wlsThMSBC0OlT8tNsRCu3h0quvj3dEfXCUeNcEY0V7 mdBzPKEr7MfCwZJQYB9NOily6HqZYjp0S3W2N3ysFWj6+SbZqnM7DvU/bmQ9Xs2FOZ9Y fEcXJKesmjMDo0w5fopc0O6bn/mYztmGpPHBqPcygRmg359FDEqU5WZgSgBijjbzeAKC yWCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n9y6shDS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a12-20020aa7cf0c000000b0051e01f391besi2045310edy.581.2023.07.11.07.17.02; Tue, 11 Jul 2023 07:17:27 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=n9y6shDS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233243AbjGKOEK (ORCPT + 99 others); Tue, 11 Jul 2023 10:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbjGKOEI (ORCPT ); Tue, 11 Jul 2023 10:04:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4428D12A; Tue, 11 Jul 2023 07:04:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD98C61505; Tue, 11 Jul 2023 14:04:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC663C433C8; Tue, 11 Jul 2023 14:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689084246; bh=hkjM3kAIgQB2MsZK32Y0LnSzvU+OKdW0pajbNogIOCY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n9y6shDSvExiH8umQsf+SFCjEhlxKpJcK1FITT1X9fxWaBcy/PBj6GNyONmVduAK7 VrN+5V1Cp/gDD5e/zaI0L7WDA3s767ezmniJorTsn3GXlqUFZeSrma97UopLdgpudB 7GEQmf3i8/WAon5QrBgT3kivHV+TBb+xGvmBcNmI= Date: Tue, 11 Jul 2023 16:04:03 +0200 From: Greg Kroah-Hartman To: Ivan Babrou Cc: linux-fsdevel@vger.kernel.org, kernel-team@cloudflare.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Tejun Heo , Hugh Dickins , Andrew Morton , Amir Goldstein , Christoph Hellwig , Jan Kara , Zefan Li , Johannes Weiner Subject: Re: [PATCH] kernfs: attach uuid for every kernfs and report it in fsid Message-ID: <2023071159-unsigned-salvation-405d@gregkh> References: <20230710183338.58531-1-ivan@cloudflare.com> <2023071039-negate-stalemate-6987@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham 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 Mon, Jul 10, 2023 at 02:21:10PM -0700, Ivan Babrou wrote: > On Mon, Jul 10, 2023 at 12:40 PM Greg Kroah-Hartman > wrote: > > > > On Mon, Jul 10, 2023 at 11:33:38AM -0700, Ivan Babrou wrote: > > > The following two commits added the same thing for tmpfs: > > > > > > * commit 2b4db79618ad ("tmpfs: generate random sb->s_uuid") > > > * commit 59cda49ecf6c ("shmem: allow reporting fanotify events with file handles on tmpfs") > > > > > > Having fsid allows using fanotify, which is especially handy for cgroups, > > > where one might be interested in knowing when they are created or removed. > > > > > > Signed-off-by: Ivan Babrou > > > --- > > > fs/kernfs/mount.c | 13 ++++++++++++- > > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c > > > index d49606accb07..930026842359 100644 > > > --- a/fs/kernfs/mount.c > > > +++ b/fs/kernfs/mount.c > > > @@ -16,6 +16,8 @@ > > > #include > > > #include > > > #include > > > +#include > > > +#include > > > > > > #include "kernfs-internal.h" > > > > > > @@ -45,8 +47,15 @@ static int kernfs_sop_show_path(struct seq_file *sf, struct dentry *dentry) > > > return 0; > > > } > > > > > > +int kernfs_statfs(struct dentry *dentry, struct kstatfs *buf) > > > +{ > > > + simple_statfs(dentry, buf); > > > + buf->f_fsid = uuid_to_fsid(dentry->d_sb->s_uuid.b); > > > + return 0; > > > +} > > > + > > > const struct super_operations kernfs_sops = { > > > - .statfs = simple_statfs, > > > + .statfs = kernfs_statfs, > > > .drop_inode = generic_delete_inode, > > > .evict_inode = kernfs_evict_inode, > > > > > > @@ -351,6 +360,8 @@ int kernfs_get_tree(struct fs_context *fc) > > > } > > > sb->s_flags |= SB_ACTIVE; > > > > > > + uuid_gen(&sb->s_uuid); > > > > Since kernfs has as lot of nodes (like hundreds of thousands if not more > > at times, being created at boot time), did you just slow down creating > > them all, and increase the memory usage in a measurable way? > > This is just for the superblock, not every inode. The memory increase > is one UUID per kernfs instance (there are maybe 10 of them on a basic > system), which is trivial. Same goes for CPU usage. Ah, ok, my fault, thanks for clearing that up. thanks, greg k-h