Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2377504ioo; Sat, 28 May 2022 11:45:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUTyiLApCMFnFfMTDGaCLoPxhCGoe/O9rWjsfr34qoP1eTzmF+3PzSfsPXIufBPKC0v5t0 X-Received: by 2002:a17:906:99c5:b0:6ff:4c8f:6376 with SMTP id s5-20020a17090699c500b006ff4c8f6376mr3500724ejn.328.1653763554105; Sat, 28 May 2022 11:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653763554; cv=none; d=google.com; s=arc-20160816; b=wi1JHhLLH1gCvsOXq4NcqaYYkMCkyGbHZUdVUZuSdu1PGt//VAzFX3NP0gIpBMIshB pgqKDnPYXCD5hICJDPbMC4p/2BCoio5Uf1zWTAQ0XDqnVDuR+cI+4HAeHh7YgcZcs8+L we5m8TsUv3DAa0hKSY9lQX910PbZuF10VkzItjt2adr7icfCmCCoRIqssuKWoeycIF0D p6bWEpcq5E4Hl8sID+/SAnKsmZPF9GHOljxj8t+dzsUkf1EAH/fWyMtuZKBvzi2lYZjI aqIdI9jsqw8HGiE1Uf1sLVkyNIBc6w0MVxZcIe/MKnDw2bKJPsXkVeF68YvRN3uI6xl7 INXw== 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=mDpmMrX6ZAj99tYsLUoYw7iDnZGlJpEI/3VF/4/WHsM=; b=pqdPP4WJRhCJqVBNVPMygjSS8cvuKJaehZ7gLTjWO3bTQ+M1HvqsMrKbwCUaZrQxNC E9SuY8WqLFbCELlKgwfhpLTki/B3MxBoHQaSAkSXpav9vyssZ55LKGPhwFX0e8ez5DhP hrCjUG5Cw+wlIpwjtHHHsvTBUNLjT8FmzDr8VitV38eDnIFDrPl4/J+caQQHZ2QhRcZT 8BbfIRKpfREmiysSyuQlATdULA0QMbjmBmLSZRGwCReusdDQiLjG9Z2sG66Dc/+G94h4 S04SGbpY5pRXELUJpKEdPdF+O0tssyfGa4I+JKj/hQN2jw0yguS6ecaxacFcj6/S7T6N BsbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hmiV/227"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u26-20020a50c05a000000b004283c794eddsi7893956edd.285.2022.05.28.11.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:45:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hmiV/227"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0ED77679; Sat, 28 May 2022 11:36:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353063AbiE0OOR (ORCPT + 99 others); Fri, 27 May 2022 10:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236208AbiE0OOL (ORCPT ); Fri, 27 May 2022 10:14:11 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DB75AA4A; Fri, 27 May 2022 07:14:08 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id wh22so9067983ejb.7; Fri, 27 May 2022 07:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mDpmMrX6ZAj99tYsLUoYw7iDnZGlJpEI/3VF/4/WHsM=; b=hmiV/2279z7xlKaFk+GxCbmDFupUyDQeF53CqctYwc3ylvA1+g67fm9AYwf3aJD52U 2Y0VNqCIPfJbF0YC3jT9aXfuCTHrZQH0zxRrdU5jcN1U1Kr3Xyjgnel+Kg8sZAH6ee2U 0dRC/R9cIcfp4pxd3fmznfBJMykLh8g3O16PpM3SZgOtK4GcYkW2MzmtU5DshhyBsBBf 3dKOBekLlhYbIn1nXTFG8IGd4yeaLAs2b4LMzjf8mjbboq9RHjfL3e/PH9gzng8YZQoR wqBZqmfZxrzbCTzS+9/EGH3SBeLUcCO/TOjFgUVkrnmnGi4VHBCbnbAcC3eLlGOH/cDk d4rg== 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=mDpmMrX6ZAj99tYsLUoYw7iDnZGlJpEI/3VF/4/WHsM=; b=XWvs1OzpyEqn2rhMU2sOJAnRMC9Qb0KkWrQvEEpybCDANviWERnMzdKTzV8aiyBUGn HfqcPxGd+loh56t7alMhH3Q0ezryCE1SoGoUud6dfyt939qEQ4TrgjxJjr4BEoNWPvNZ nmKroZJUnPRTnYy980ah4Ud0Ta9/Ccdh3twtCIZrU/dqNDrlTKjQK/GZPi6iKeX3sY0f gWEXI5FzA9O12F2/E7cSft5VY1WiOxWEv4rVUMWSCqIdp44M+qyDKeZR/WAONDI2BG8v K2gQVHlJ3wEXPjZyQtzfG1xN+aWXYySc4QaQiaVBdXQ5mtkDd1o6ca2HmJVlmG6XPbT9 ePnA== X-Gm-Message-State: AOAM5320hwJ+ArNo4XFq8NN+JwUKClRz+yG1JczUhHhT/Y10LQMQqysQ wQRha3zL6V8EzSfVax4KAaQES3v6XH5Ksu67WVk= X-Received: by 2002:a17:907:7da5:b0:6fe:d818:ee49 with SMTP id oz37-20020a1709077da500b006fed818ee49mr24958685ejc.58.1653660847121; Fri, 27 May 2022 07:14:07 -0700 (PDT) MIME-Version: 1.0 References: <20220527110959.54559-1-zhangyuchen.lcr@bytedance.com> In-Reply-To: <20220527110959.54559-1-zhangyuchen.lcr@bytedance.com> From: Alexei Starovoitov Date: Fri, 27 May 2022 07:13:54 -0700 Message-ID: Subject: Re: [PATCH] procfs: add syscall statistics To: Zhang Yuchen Cc: Andrew Morton , David Hildenbrand , Peter Zijlstra , Ingo Molnar , Alexei Starovoitov , LKML , Linux-Fsdevel , "open list:DOCUMENTATION" , linux-arm-kernel , linux-s390 , Linux API , fam.zheng@bytedance.com, bpf Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,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 Fri, May 27, 2022 at 4:10 AM Zhang Yuchen wrote: > > Add /proc/syscalls to display percpu syscall count. I second Peter's nack. We don't add debug features to the production kernel. > We need a less resource-intensive way to count syscall per cpu > for system problem location. > > There is a similar utility syscount in the BCC project, but syscount > has a high performance cost. There are two syscount tools in BCC: tools/syscount libbpf-tools/syscount Which one has this 42% overhead? The former tool is obsolete though. It was written in the days when bpf had 1/10 of the features it has today. Both tools can be optimized. They attach to raw_syscalls tracepoint. tracepoints are not cheap. In terms of overhead: tracepoint > raw_tracepoint > fentry. bpf can attach to all three. Please profile libbpf-tools/syscount tool with perf and unixbench, understand where overhead comes from and then optimize the tool.