Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5340820rwd; Mon, 12 Jun 2023 03:49:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ44zVb//J9FOrcp3Ae4mfjAIT1NHK6Y77CRSoOjme4ebA0j78u1PGUyaZ633duH/28Cv//B X-Received: by 2002:a17:902:7c17:b0:1b1:e002:703a with SMTP id x23-20020a1709027c1700b001b1e002703amr5931880pll.12.1686566991638; Mon, 12 Jun 2023 03:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686566991; cv=none; d=google.com; s=arc-20160816; b=up5FD1JEABPKtwkpNSA8M3EGAzWLasZWVFvdRX39u+22DgdnupFTaeskZ4Ya527SkI W2PtubgYhNy4BBpNEcOjbg5qMHVnUZxu18L09gDAz2tH/TS4P3iFCgzSzI7TydPuLeqe gQyKhmXSv33V2XixTyUJvPJzEUat7g5Oq50hbPLOQrs5DDl+FPKyyH7Zk9mhAgqoM3bW q5CpsT43/cVSW92mm5ZeXx0WruzfziA1zMZEK8ewesj+a9p6uEXr/kc3gKnBivhnhtJv qpqyP8GD2fpVw67ZSTsk9j+S18dSvoyObACgYUs+xJN//i++I76XmWpJ8EcsDpyMHlTE H8EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:cc:to:subject:from; bh=Ks3OUFN8YhJpKNRA68a6Xep+SBuMuel0jr0R/qszMts=; b=i2BoxwaHiU2iZ3gNP2fVM0zTKRay5jv+aYZDsSEkWEqRVXw/a9aH87qHpHeHCDIuI7 TpluaOB9By8bxWPr08DZstqCW1P4XPBNq6T0Xl/iN22PAXiAkxM4CUz760YUfDLJ0wvE B1xhelW8eQWTAsOTnidx8T49bCYTIDIr/ibUZYUrfQzBc2jFOHOdaAUdLR/RvN3Jhcg5 HGMSXOtu0R7qJaHkedjPR/wTQz9GqB5yLokg4NJ9ctglTnnECCLRFcvccYgBoBjomE2K pLu0q0Wi0SI8i158lhghBI/myzvGcyM99iEt53ZflxF2sdyUQzgL+d2ViL2fMDhSeXK5 gTgw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a17090301d000b001b1ac20dbb1si3401027plh.400.2023.06.12.03.49.39; Mon, 12 Jun 2023 03:49:51 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234965AbjFLKmb (ORCPT + 99 others); Mon, 12 Jun 2023 06:42:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233967AbjFLKmE (ORCPT ); Mon, 12 Jun 2023 06:42:04 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C0228231; Mon, 12 Jun 2023 03:26:27 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Qfnrk72zNzTl2n; Mon, 12 Jun 2023 18:25:42 +0800 (CST) Received: from [10.67.111.205] (10.67.111.205) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 18:26:10 +0800 From: Yang Jihong Subject: [RFC] Adding support for setting the affinity of the recording process To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users , linux-kernel CC: Yang Jihong Message-ID: <159de73b-fdd6-6df8-4f77-73c628fe641f@huawei.com> Date: Mon, 12 Jun 2023 18:26:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.111.205] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hello everyone, Currently, perf-record supports profiling an existing process, thread, or a specified command. Sometimes we may need to set CPU affinity of the target process before recording: # taskset -pc # perf record -p -- sleep 10 or: # perf record -- `taskset -c COMMAND` I'm thinking about getting perf to support setting the affinity of the recording process, for example: 1. set the CPU affinity of the process to , process to , and record: # perf record -p /:/ -- sleep 10 and 2. set CPU affinity of the COMMAND and record: # perf record --taskset-command COMMAND In doing so, perf, as an observer, actually changes some of the properties of the target process, which may be contrary to the purpose of perf tool. Will we consider accepting this approach? Thanks, Yang.