Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp421125rwe; Thu, 1 Sep 2022 01:34:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zcMXhpim8zidpjhfqZUsUFfX+xEZKLUiXaI655YynjhnfatD/VTw7pv5fB7xr0kLjqbsl X-Received: by 2002:a17:903:11d0:b0:171:2cbc:3d06 with SMTP id q16-20020a17090311d000b001712cbc3d06mr28598814plh.142.1662021255664; Thu, 01 Sep 2022 01:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662021255; cv=none; d=google.com; s=arc-20160816; b=K1C3W4AccoB1ftwbNP4xTxpbNTUOB+1+13KgMQxLFMkCa9JpQrFgv2ri+UXItdgAOk CNFfBK1XfjZ+Vl1GsfthONVwja86qmXyHBAfE8eQCtl5Iy7vUseJqiP53w9Wwuxh06C9 0NH0ziIQCVSnslAEZqFOuOeUcEYMaoEQ7Qb3qiWZ2F6S+RRmjdwHjXNXzTrE3L505Fsl /fuUm877n5AJsmaBGANvB879sBeZwHSt2OT9hTJEeCeiHQmi9XpV3vyJwi1/TG8HAOv/ Lb6F5ibQ5DDCBrRBKDop89anHGgC6qbTBFpfu3/r0SknBJlF+dTtIVKbhTdm304IrcZD u55A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=w/uTT8lnpogUVhwkYNDxdhGZzOyBXG3eWWImkgPiyoM=; b=deoEMEDZTp4d3rN2DgP4fzYfcvnIgzPgU9po8Qf1fZ/oMuuW7gmtGi3KnIH5kcWfSV LXG/WtuSanSp2M2xG+qMY+d1W0Hfco8+F3S20hKqBf04izls0xdYn9+jn9CKVT3EWNVw jEoS11YxMMSyCYlzkEmGscvbvpAJzKYEeHfFbkTorBLURDIuJASgPJTY8QRUifnIcjZz LSEJVRNLBWNQuUlgIAEJ50998BZ7W+ZTtf6sNfoQEqoDiXtenHx0eZaMjC7Vz7/xd3Jw zCYYNz+QEutqT2CIWVHJ7O8tC0QZttpLEoI1NeNjyHSqZd23nSLjpFDc6Wpubr9TZKg6 SClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DgayC5dy; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056a00190600b0053aa96b10besi4382344pfi.142.2022.09.01.01.33.55; Thu, 01 Sep 2022 01:34:15 -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=@redhat.com header.s=mimecast20190719 header.b=DgayC5dy; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbiIAHhJ (ORCPT + 99 others); Thu, 1 Sep 2022 03:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbiIAHhH (ORCPT ); Thu, 1 Sep 2022 03:37:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D59AF8FD6 for ; Thu, 1 Sep 2022 00:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662017823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w/uTT8lnpogUVhwkYNDxdhGZzOyBXG3eWWImkgPiyoM=; b=DgayC5dyfaeGXWgqcGu/YcLeWOxlSxKhLpPoQminM/M3pGbY73WxztkrhpaiegTmoZhNJ8 izs+WXb28e8YU80Odx6KsPd3FU1KYrTVx+iSPIcqidvGBQAiflWSAlmYLqzBNBPGWuxK7P 3MPhtjSRmJCu6jTPnEFblE1h4PJh5q8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-339--v-pdaKdOjC7W9Saxlpu3A-1; Thu, 01 Sep 2022 03:37:02 -0400 X-MC-Unique: -v-pdaKdOjC7W9Saxlpu3A-1 Received: by mail-ed1-f69.google.com with SMTP id w17-20020a056402269100b0043da2189b71so10959947edd.6 for ; Thu, 01 Sep 2022 00:37:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=w/uTT8lnpogUVhwkYNDxdhGZzOyBXG3eWWImkgPiyoM=; b=SsnVfE8nbCHSdqUQS63WVgJ9VFS/rs91OP14FG+h2lRAFVXUQYTrrrJsrSOV7NIoGI Zfy9rVYdytIhyzitTopQJX48O+BmzyZwAybi5OGS3xGauDC22qPKV6yODrK4RAdmBuAM KR5wXC6oFzn95yfngfVsIru3U02QY5hh5iaoGT4SZ9dKVxtkdYfc3DzAVCWqc3GJh5Ya oZ7UYBMPJqRraljf31wR1kABtnT5zq+NutoB0Yp/51/0xWz6xiLZCUPHvNKs9RFqeJ0j 6boKaiuHvG/kv9S808SafGN0RVDxRjJQKCWNahrQ0jxMEFyj8bmcn9O96RY+e9+Sq6xJ t+/A== X-Gm-Message-State: ACgBeo2fh7XPwotHxBzmg/o0LBi+FoqCLupTTDWZtEavfleogiDkxO46 srSWCyx/g+wAg841AKcXVMYK/ZnP2RfQzu6bLMqvebUHUyqAVw8nJtQvXgT4YhJwom7vQzTbyFy p0hvG9ykZl6h/AjIJ4VsXnY1Y X-Received: by 2002:aa7:d90e:0:b0:447:986d:b71e with SMTP id a14-20020aa7d90e000000b00447986db71emr27210713edr.235.1662017821493; Thu, 01 Sep 2022 00:37:01 -0700 (PDT) X-Received: by 2002:aa7:d90e:0:b0:447:986d:b71e with SMTP id a14-20020aa7d90e000000b00447986db71emr27210669edr.235.1662017821253; Thu, 01 Sep 2022 00:37:01 -0700 (PDT) Received: from [192.168.0.198] (host-87-8-60-205.retail.telecomitalia.it. [87.8.60.205]) by smtp.gmail.com with ESMTPSA id u24-20020aa7d998000000b0043a61f6c389sm898086eds.4.2022.09.01.00.36.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Sep 2022 00:37:00 -0700 (PDT) Message-ID: <37a66a8d-859d-5a8b-e298-d0c32e2028e7@redhat.com> Date: Thu, 1 Sep 2022 09:36:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [RFC PATCH 00/30] Code tagging framework and applications Content-Language: en-US To: Peter Zijlstra , Kent Overstreet Cc: Mel Gorman , Suren Baghdasaryan , akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, void@manifault.com, juri.lelli@redhat.com, ldufour@linux.ibm.com, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, changbin.du@intel.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, arnd@arndb.de, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-mm@kvack.org, iommu@lists.linux.dev, kasan-dev@googlegroups.com, io-uring@vger.kernel.org, linux-arch@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220830214919.53220-1-surenb@google.com> <20220831084230.3ti3vitrzhzsu3fs@moria.home.lan> <20220831101948.f3etturccmp5ovkl@suse.de> <20220831155941.q5umplytbx6offku@moria.home.lan> From: Daniel Bristot de Oliveira In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 9/1/22 09:05, Peter Zijlstra wrote: >> Also, ftrace can drop events. Not really ideal if under system load your memory >> accounting numbers start to drift. > You could attach custom handlers to tracepoints. If you were to replace > these unconditional code hooks of yours with tracepoints then you could > conditionally (say at boot) register custom handlers that do the > accounting you want. That is strategy in RV (kernel/trace/rv/). It is in C, but I am also adding support for monitors in bpf. The osnoise/timerlat tracers work this way too, and they are enabled on Fedora/Red Hat/SUSE... production. They will also be enabled in Ubuntu and Debian (the interwebs say). The overhead of attaching code to tracepoints (or any "attachable thing") and processing data in kernel is often lower than consuming it in user-space. Obviously, when it is possible, e.g., when you respect locking rules, etc. This paper (the basis for RV) shows a little comparison: https://bristot.me/wp-content/uploads/2019/09/paper.pdf By doing so, we also avoid problems of losing events... and you can also generate other events from your attached code. (It is also way easier to convince a maintainer to add a tracepoints or a trace events than to add arbitrary code... ;-) -- Daniel