Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1215552ybl; Tue, 3 Dec 2019 03:41:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzGupB4t7gIDeO6bjUyXNUwx/59YeyDVjoBjPOvuFJjqtcTNC2wBfp9ipqGh8Trj8HozciI X-Received: by 2002:a05:6830:10c9:: with SMTP id z9mr2809356oto.200.1575373297743; Tue, 03 Dec 2019 03:41:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575373297; cv=none; d=google.com; s=arc-20160816; b=xwtUh4kqv6y9fqhewyfCNXUaYn0dW5ykiI3vuFvJ0EVl48l+FLEnwwg7fkQwcUsuwt xtsnZYUhR64okmKnQj5l5HfZQDHm3GyKTQSfiiFtKCbuBehVYDQte296sRZmVPAcJQQF YR1o+YzlbMnHJ4S60ECnVUIwny9pRRs4HVDWwc4++JmGkPcxjBj9sfLsuQ78K378TGVC puv2csNBFjxu65r8E5IglfpMrvVu0fe0G/C++f5fkhCK0qEKEQFAwInGG4P5cmBHxNnc oJucwGuckoOl74Oe2zt9e3inrWmfWCmfRgMty2ghq3bogo+dVkTBIO36saw4CXUu88eG W8Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=E1veSKZ2RJOmNxtCbmuKNSTHCFp26trC7SGQf1C+OjU=; b=rR0SrxY1iENMcM5OzT3AMUyHPtZjhtvpkQlJQu1CBdWdZxROUbdPORAJa38q+sPVFv vDxI8m4GCMaOhWCFzHLHFxJiRnTMmRUygk7HBGIpnaivYaij0PtXoYheJE8E6T0QLo/6 AF4l/sNkJXVNr08K+YmqU5W78ECx/E5eT8GXwI0rHr+qn4Bet68k4/P74G0xClcMKAua P1xH9Y7iJ6mAHe20wISbXN541gpUHQRO7AoBfmlzYWWnNK2IUj5YLpnFkLrArM4xJN92 7dNH7aPIf1rn84kgMVyAy8jJhdfZAUlu+qH3E8ySGU97pFSBQHGAVyMe2AvLJBgvMdMD ZnCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si1031139otb.280.2019.12.03.03.41.25; Tue, 03 Dec 2019 03:41:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726182AbfLCLkc (ORCPT + 99 others); Tue, 3 Dec 2019 06:40:32 -0500 Received: from mga05.intel.com ([192.55.52.43]:48897 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfLCLkc (ORCPT ); Tue, 3 Dec 2019 06:40:32 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Dec 2019 03:40:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,273,1571727600"; d="scan'208";a="204945807" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 03 Dec 2019 03:40:32 -0800 Received: from [10.125.253.16] (abudanko-mobl.ccr.corp.intel.com [10.125.253.16]) by linux.intel.com (Postfix) with ESMTP id EF06A58033E; Tue, 3 Dec 2019 03:40:29 -0800 (PST) Subject: Re: [PATCH v4 3/3] perf record: adapt affinity to machines with #CPUs > 1K To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel References: <2095b034-bf53-c374-0e34-adc006b00fbb@linux.intel.com> <20191203101252.GD17468@krava> <20191203112335.GF17468@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: <9737af83-3c6d-d96a-d297-bdfb15594416@linux.intel.com> Date: Tue, 3 Dec 2019 14:40:28 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191203112335.GF17468@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03.12.2019 14:23, Jiri Olsa wrote: > On Tue, Dec 03, 2019 at 01:48:05PM +0300, Alexey Budankov wrote: >> >> >> On 03.12.2019 13:12, Jiri Olsa wrote: >>> On Mon, Dec 02, 2019 at 09:58:48AM +0300, Alexey Budankov wrote: >>> >>> SNIP >>> >>>> >>>> -static void build_node_mask(int node, cpu_set_t *mask) >>>> +static void build_node_mask(int node, struct mmap_cpu_mask *mask) >>>> { >>>> int c, cpu, nr_cpus; >>>> const struct perf_cpu_map *cpu_map = NULL; >>>> @@ -240,17 +242,23 @@ static void build_node_mask(int node, cpu_set_t *mask) >>>> for (c = 0; c < nr_cpus; c++) { >>>> cpu = cpu_map->map[c]; /* map c index to online cpu index */ >>>> if (cpu__get_node(cpu) == node) >>>> - CPU_SET(cpu, mask); >>>> + set_bit(cpu, mask->bits); >>>> } >>>> } >>>> >>>> -static void perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *mp) >>>> +static int perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params *mp) >>>> { >>>> - CPU_ZERO(&map->affinity_mask); >>>> + map->affinity_mask.nbits = cpu__max_cpu(); >>>> + map->affinity_mask.bits = bitmap_alloc(map->affinity_mask.nbits); >>>> + if (!map->affinity_mask.bits) >>>> + return -1; >>> >>> hum, this one should be also behind (rec->opts.affinity != PERF_AFFINITY_SYS) >>> condition, right? sry I haven't noticed that before.. >> >> That has not been so far, but, probably like this: >> >> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c >> index 7f573f646431..832d2cb94b2c 100644 >> --- a/tools/perf/util/mmap.c >> +++ b/tools/perf/util/mmap.c >> @@ -269,7 +269,8 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu) >> return -1; >> } >> >> - if (perf_mmap__setup_affinity_mask(map, mp)) { >> + if (mp->affinity != PERF_AFFINITY_SYS && >> + perf_mmap__setup_affinity_mask(map, mp)) { >> pr_debug2("failed to alloc mmap affinity mask, error %d\n", >> errno); >> return -1; > > yes, that works too Included into v5. Thanks, Alexey