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 D3DBCC7EE25 for ; Mon, 12 Jun 2023 10:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234045AbjFLKmc (ORCPT ); Mon, 12 Jun 2023 06:42:32 -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 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.