Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp370177rwb; Tue, 25 Jul 2023 17:31:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlEVWENJYq9UtMj1jCTPfO9/DA+TLl4dBnY2vp24knOjoJFB9WQCnK/MlGbtxdUUV9bZaDem X-Received: by 2002:a17:90a:ba16:b0:268:5558:de4c with SMTP id s22-20020a17090aba1600b002685558de4cmr1307pjr.38.1690331494718; Tue, 25 Jul 2023 17:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690331494; cv=none; d=google.com; s=arc-20160816; b=rsxjD48UoppZ94MS2YONY1skL2m0/FgWhxJ8b3QywmZZ3mT+Qr3te7nHHB/wowBjoR t8ruIIS5rxLLkcJkL/fpfsKl3EfMeOheI5ixTKKZT5XC7CxQPZ3J4EnauZ4UfiYGGPMs lGhCAs2kQq1KmgGxtPcvuaBIFFq2l9PtmaGOV+pvvctAM1GyW2+xyaqfgBV1qyZsNTaP b6p92SndIFE6vJTqq5uM/xRhJTlSrfkH3oaZtOpKKsJ9eRVqkg+zAUMtzzRmxx7QRWAS pgglbaEJe6BigeomAWsoAqnYYfayAN7qnGfBH/zdzMj63gGnq01onyZHw/JywkduzRnG VRag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Y0V/EEMFzUDgOJY1HEZ2mzSgEOY/cF7JWrxdvLNmC4c=; fh=d+60COagxz1Fk6iIkzlTEIkIjojdqvY19izLInw8YbE=; b=d1HqNXaG6xrMDKgFQuYPJZZIcw+hkiuqWFWtUv2l7AHlNMJHJwyQz+IvjyuN0QFqVX MXX4w54TgvmbHYyotXmFwlqfHIq21Ta9skP3CLzpQu1muTKhJ3B2zNmtsK+iP6lVQab6 vdcuqDKH/93weOB7RvZnzue5d1w/nCi6ADgf/ao8tghIe4jY6MuqOupxzeoCb1wWyHlH n6Yu91yo0yWOS+gzvdc/N1m3OnkaEscFHHxSlwqcNV0k1o6npd5Yp6v/Wwa4Uk9AgZsx QJTyJ2bx5gEVtQw1kNH+1ZsdWTQAEpqUjdNi+HO/5MPmMPU6AK/LX+tH0scXULYr6R41 5Q9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=HQmhRjdD; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a17090b010100b0026359084fd2si242039pjz.69.2023.07.25.17.31.22; Tue, 25 Jul 2023 17:31: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=pass header.i=@cloudflare.com header.s=google header.b=HQmhRjdD; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbjGYX7E (ORCPT + 99 others); Tue, 25 Jul 2023 19:59:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbjGYX7C (ORCPT ); Tue, 25 Jul 2023 19:59:02 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEEC82696 for ; Tue, 25 Jul 2023 16:58:59 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3174aac120aso2926621f8f.2 for ; Tue, 25 Jul 2023 16:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; t=1690329538; x=1690934338; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Y0V/EEMFzUDgOJY1HEZ2mzSgEOY/cF7JWrxdvLNmC4c=; b=HQmhRjdDvJ1uYczgxWnKD2vuEgMQ1C34U5qNTVu5bgQnwC4Bo65ZfziU37Xl9ReMuI ljgsg+zC1ZyZKpd6J4xCbFL7r/WFBlobzR0fNJHPHHsEVIs1APIzpwzPPIJWZ9biqp/R QfbRvQeOQiOMI8y/jOcru47WwYghRDHy+nC0Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690329538; x=1690934338; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y0V/EEMFzUDgOJY1HEZ2mzSgEOY/cF7JWrxdvLNmC4c=; b=YYEX/o59HauFbXrEzI6+Pp4rCOgPIAvEKQbicfFmXSGm3/hq0wIxC3rEc1XEcpFI6l 2U1YClzQ8vflRswK5JQdQIe1nYruxpNedZDLg3WdAkhKKex3GxzZT8VYaGeq9+7mZdrH JO/uEiY1TTAdZ11vbuEeKxXZZinOYG/SkXjHgCI+B38IiUsr6/Y0q44x6+IvV7VO5Oti 1hAuMYRIOpdUlAjeBVsO816yjpwueI0LzbftNrgxguPS/n8gTGjYzpH1OPuPj+cYDAWB fGguWE6RVTkbVskgL9NNxev6COepjNYcboRKNZ3y9I0gUW5mXDTNaR27tncPZrpAr1wq N6XQ== X-Gm-Message-State: ABy/qLZehDnSraV98OEgKYQ2DY429Jta02DUVrJV7oF8awsTtSlmLibT JHDvoAbujOMhypgAbQ6SxRG0JtVifdr5ZpyJcSZAhw== X-Received: by 2002:a5d:49c5:0:b0:316:fb39:e045 with SMTP id t5-20020a5d49c5000000b00316fb39e045mr180608wrs.48.1690329538460; Tue, 25 Jul 2023 16:58:58 -0700 (PDT) MIME-Version: 1.0 References: <20230710183338.58531-1-ivan@cloudflare.com> <2023071039-negate-stalemate-6987@gregkh> In-Reply-To: From: Ivan Babrou Date: Tue, 25 Jul 2023 16:58:47 -0700 Message-ID: Subject: Re: [PATCH] kernfs: attach uuid for every kernfs and report it in fsid To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Greg Kroah-Hartman , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 Tue, Jul 25, 2023 at 7:07=E2=80=AFAM Michal Koutn=C3=BD wrote: > > Hello. > > On Mon, Jul 10, 2023 at 02:21:10PM -0700, Ivan Babrou wrote: > > I want to monitor cgroup changes, so that I can have an up to date map > > of inode -> cgroup path, so that I can resolve the value returned from > > bpf_get_current_cgroup_id() into something that a human can easily > > grasp (think system.slice/nginx.service). > > Have you considered cgroup_path_from_kernfs_id()? * It's not available from bpf from what I see (should I send a patch?) * It turns short numeric keys into large string keys (you mention this belo= w) * It's a lot more work upfront for every event under a spinlock > > Currently I do a full sweep to build a map, which doesn't work if a > > cgroup is short lived, as it just disappears before I can resolve it. > > Unfortunately, systemd recycles cgroups on restart, changing inode > > number, so this is a very real issue. > > So, a historical map of cgroup id -> path is also useful for you, right? > (IOW, cgroup_path_from_kernfs_id() is possible but it'd inflate log > buffer size if full paths were stored instead of ids.) For the most part the historical map would not be necessary if we had cgroup paths (except for the points I mentioned above). > (I think a similar map would be beneficial for SCM_CGROUP [1] idea too.) Yes, it seems like it. > > There's also this old wiki page from systemd: > > > > * https://freedesktop.org/wiki/Software/systemd/Optimizations > > The page also states: > > > Last edited Sat 18 May 2013 08:20:38 AM UTC > > Emptiness notifications via release_agent are so 2016 :-), unified > hiearchy has more convenient API [2], this is FTR. Sure, but these aren't arguments against having fanotify for cgroup filesys= tem.