Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1280249pxb; Sun, 12 Sep 2021 13:46:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6TmOG2JzMxM9IWcNvHO+F9zzHL2AES1yejaamOC+S+L2Rek55wQKcS+vM+rU/dcGLJv+X X-Received: by 2002:a05:6e02:f91:: with SMTP id v17mr6037582ilo.0.1631479618758; Sun, 12 Sep 2021 13:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631479618; cv=none; d=google.com; s=arc-20160816; b=LIG9YoRob1WjFSD+Xj6uEHmQ45WO1t7h+S/xHLaulbxxpFU7Dlt0/K+JRGPGWfQTip BFY1Uoqd/nb12j61CWkPEw9xBTndn9W4mLofkXclh8AZAQ0iF39tqYWJPaYomF8RxrzO vjrrmpOoxR1U0x2EkQUFGg8Dd4RD2peMajyGCEd+VaDADSsdnmKyKmr3pnwntsm2FrwI LGsTQNImyGXKFumjP9yGxRodTjGhtAvOi5P+TLuf61xY+xAQnqBq5DKRiKUP5ExTDUno X2ltpNNFPWiMSlK5RRBC7W+trEnM97mlgi7g4iBdm94WRZj9B4VWaQ/Uro49UP41iDue WZog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nz/SHfiZKSjrdeek/3NP4iE5Fo2U6gkjdfLRfVYygDY=; b=ToIJaQqRjTN/0ut0A7cqZHNDCBhCLdw0YSTvb84e78WX+0VuNn4fLOVQ6B1LPmEfsM KjlcxfFeQt/7BfqGHG/NAdrriNVbM55rjQjyGti8IwkrYI5Qyz9+CQkL33cgFzFxrrGO KYouhmoxeDIcDKkKYrLmljTnj75CGDgSiXn69JVz3mNtTxnAdY51Np89ImCmvrE+npfg aeA0xTeVG1ENqTJXilvMfvjrSNfLVhvaaMlDBwfsFhng/sUjSQoE+0lUzH7mix0kc3vx aM0mMrdDPYXVfiCUbv573vXG0qn/iBZlt4p+OUOcmVkThoPlagHKGC4vOeUVOl066UVO I8Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZEUEyj8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si4896822ila.149.2021.09.12.13.46.47; Sun, 12 Sep 2021 13:46:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZEUEyj8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236445AbhILUqu (ORCPT + 99 others); Sun, 12 Sep 2021 16:46:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21449 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236436AbhILUqt (ORCPT ); Sun, 12 Sep 2021 16:46:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631479534; 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: in-reply-to:in-reply-to:references:references; bh=nz/SHfiZKSjrdeek/3NP4iE5Fo2U6gkjdfLRfVYygDY=; b=ZEUEyj8WWOvNAbQl1chDZgP0KW3ghutXlyE/0287kElwodUcm8872Yb49dSb1zqelO6Gv/ aSJtr/6xwzOpUQIxLyI8AygZ7nkmrGcA7TNlRq4I9nUEEVZPpKmF+TEoH2E5mfD6TfdsFO aW8EU3SXPUNg1ocEbIrd2GsC25AXWSU= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-562-dWTQJAXQOEWYFqTFUtxn2Q-1; Sun, 12 Sep 2021 16:45:33 -0400 X-MC-Unique: dWTQJAXQOEWYFqTFUtxn2Q-1 Received: by mail-ed1-f71.google.com with SMTP id u2-20020aa7d982000000b003cda80fa659so3856255eds.14 for ; Sun, 12 Sep 2021 13:45:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nz/SHfiZKSjrdeek/3NP4iE5Fo2U6gkjdfLRfVYygDY=; b=G2z+WS7AQdsNvqsS4D1Dqy1dtACllrRdMkZmDtza9fY0zbnF0Vj4zqoRxSmYvqQK+I wEzKxA4UgAA+CJuTydrXbE2o6fae3/O+QOKF49RqlVZAekwO9CBtqXj3pz6tJhOkMu8c cxCygkzxDSBAZNfp7lAooDAaErFftVdhvws3tHAsJHWEOgbKVdVxY2sIxd2mhVefY2fC v32wThIr+4rSjWK+sHFqCSX4YsJiGqqLcOw38XGrig5/IcStHrrVTK+wZaC6JsOpGqvY xxi/bJlxqbq7DVIBMNcO0oGeelEmgP7xw6BojVL/ebEH/MXT5gNcASs5bw+GvZikfEpf BkoQ== X-Gm-Message-State: AOAM533EB0Gt5nP6EopAtpNss4a95lYFdH4aW2h/qtB6VZdJgsigZjbc yOYXbmEIPPR0XdtsFANzy5z7DOIn5cZ3UBxwGs4VPPSFEZOZjLzO+19dHyMOSTb04F0af7AoSLO qaAyJ5KpL3DOz29JU7ltGG1zm X-Received: by 2002:a50:bb09:: with SMTP id y9mr5421978ede.89.1631479532538; Sun, 12 Sep 2021 13:45:32 -0700 (PDT) X-Received: by 2002:a50:bb09:: with SMTP id y9mr5421957ede.89.1631479532399; Sun, 12 Sep 2021 13:45:32 -0700 (PDT) Received: from krava ([83.240.60.52]) by smtp.gmail.com with ESMTPSA id e28sm2795337edc.93.2021.09.12.13.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 13:45:32 -0700 (PDT) Date: Sun, 12 Sep 2021 22:45:30 +0200 From: Jiri Olsa To: Alexey Bayduraev Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini Subject: Re: [PATCH v11 01/24] perf record: Introduce thread affinity and mmap masks Message-ID: References: <328c6ae8904139d1fba882a2daa75405a086e5cf.1629186429.git.alexey.v.bayduraev@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <328c6ae8904139d1fba882a2daa75405a086e5cf.1629186429.git.alexey.v.bayduraev@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 17, 2021 at 11:23:04AM +0300, Alexey Bayduraev wrote: SNIP > +static int record__init_thread_default_masks(struct record *rec, struct perf_cpu_map *cpus) > +{ > + int ret; > + > + ret = record__alloc_thread_masks(rec, 1, cpu__max_cpu()); > + if (ret) > + return ret; > + > + record__mmap_cpu_mask_init(&rec->thread_masks->maps, cpus); > + > + rec->nr_threads = 1; > + > + return 0; > +} > + > +static int record__init_thread_masks(struct record *rec) > +{ > + struct perf_cpu_map *cpus = rec->evlist->core.cpus; > + > + return record__init_thread_default_masks(rec, cpus); > +} > + > +static void record__fini_thread_masks(struct record *rec) > +{ > + record__free_thread_masks(rec, rec->nr_threads); > + > + rec->nr_threads = 0; hum, is this needed? jirka > +} > + > int cmd_record(int argc, const char **argv) > { > int err; > @@ -2883,6 +3011,12 @@ int cmd_record(int argc, const char **argv) > goto out; > } > > + err = record__init_thread_masks(rec); > + if (err) { > + pr_err("record__init_thread_masks failed, error %d\n", err); > + goto out; > + } > + > if (rec->opts.nr_cblocks > nr_cblocks_max) > rec->opts.nr_cblocks = nr_cblocks_max; > pr_debug("nr_cblocks: %d\n", rec->opts.nr_cblocks); > @@ -2901,6 +3035,7 @@ int cmd_record(int argc, const char **argv) > symbol__exit(); > auxtrace_record__free(rec->itr); > out_opts: > + record__fini_thread_masks(rec); > evlist__close_control(rec->opts.ctl_fd, rec->opts.ctl_fd_ack, &rec->opts.ctl_fd_close); > return err; > } > -- > 2.19.0 >