From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B350BEB64DA for ; Mon, 10 Jul 2023 19:41:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbjGJTlI (ORCPT ); Mon, 10 Jul 2023 15:41:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbjGJTlH (ORCPT ); Mon, 10 Jul 2023 15:41:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7436A115; Mon, 10 Jul 2023 12:41:06 -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 11A1C611BD; Mon, 10 Jul 2023 19:41:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB2DEC433C8; Mon, 10 Jul 2023 19:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689018065; bh=4JghVo9ntVNo5eow2Va+8PEDtvw9T3mWBVw4q3zNsuI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wjxjdxwy8939dFbsEfTW/y4r4/FPIAMEe5+YtOiWABsy3aE9uptN/GNiWKzmHAoPq DJvfGpgFffG/ZEvc60Rx3ATbNnciqmW36W4CrJOMvHCKGSwfF1eUaHUQD/9fJEnOos CsPWfrUnXzLouSyf4k+sRmvtRunIgOXxZIAO2zOQ= Date: Mon, 10 Jul 2023 21:41:02 +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: <2023071046-paramount-climatic-31cb@gregkh> References: <20230710183338.58531-1-ivan@cloudflare.com> <2023071039-negate-stalemate-6987@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2023071039-negate-stalemate-6987@gregkh> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Jul 10, 2023 at 09:40:23PM +0200, 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? > > We were trying to slim things down, what userspace tools need this > change? Who is going to use it, and what for? > > There were some benchmarks people were doing with booting large memory > systems that you might want to reproduce here to verify that nothing is > going to be harmed. Oh wait, is this just a per-superblock thing? confused, greg k-h